码迷,mamicode.com
首页 > 编程语言 > 详细

centos7 安装pip+python3.6

时间:2018-09-03 02:35:15      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:line   默认   软件   color   post   curses   pip3   epel   sqli   

centos7安装pip

1.执行:yum install python-pip

若没有python-pip包,先执行:yum -y install epel-release,再执行yum install python-pip

2.pip install --upgrade pip

centos默认安装了python2.7

1.mkdir /usr/local/python3

2.安装依赖包:

yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

3.在/usr/local/python3目录下

wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz

4.在/usr/local/python3目录下

tar -xvf  Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
make && make install

5.切换到/usr/bin/目录下

mv python python.bak
mv pip pip.bak
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip

6.防止以后用yum源安装软件时,报错

vi /usr/bin/yum
输入i,把文件开头第一行的

#!/usr/bin/python改成#!/usr/bin/python2.7

vi /usr/libexec/urlgrabber-ext-down

输入i,把文件开头第一行的

#!/usr/bin/python改成#!/usr/bin/python2.7

7.验证

输入python,进入python3.6.2

输入python2,进入python2.7

centos7 安装pip+python3.6

标签:line   默认   软件   color   post   curses   pip3   epel   sqli   

原文地址:https://www.cnblogs.com/caicaizi/p/9576424.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!