centos7 python3 安装

mkdir /usr/python3.5

tar -xf Python-3.5.1.tgz

cd Python-3.5.1

./configure --prefix=/usr/python3.5

make & make install

在/usr/bin中有python、python2、python2.7三个文件依次指向后者,我们将python备份

cd /usr/bin

mv python python.bak

ln -s /usr/python3.5/bin/python3 /usr/bin/python

因为yum使用python2,因此替换为python3后可能无法正常工作,因此修改yum配置文件(sudo vi /usr/bin/yum)。
将第一行指定的python版本改为python2.7(#!/usr/bin/python 改为 #!/usr/bin/python2.7)

pip 是一个安装和管理 Python 包的工具 , 是 easy_install 的一个替换品。

distribute是setuptools的取代(Setuptools包后期不再维护了),pip是easy_install的取代。

pip的安装需要setuptools 或者 distribute,如果你使用的是Python3.x那么就只能使用distribute因为Python3.x不支持setuptools。


ln -s /usr/python3.4/bin/easy_install /usr/bin/easy_install
ln -s /usr/python3.4/bin/pip /usr/bin/pip

原文地址:https://www.cnblogs.com/yuyutianxia/p/6640960.html