6、将/usr/local/python3/bin加入到环境变量
[root@bogon Python-3.6.1]# vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/python3/bin
[root@bogon Python-3.6.1]# source ~/.bash_profile ##使环境变量生效
[root@bogon Python-3.6.1]# python3 -V ##测试python3正常
Python 3.6.1
[root@bogon Python-3.6.1]# pip3 -V ##测试pip3正常
pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6)
7、修改yum指向python 旧版本
[root@bogon pip-8.0.2]# vi /usr/bin/yum
#!/usr/bin/python2.6
二、安装pip及setuptools
1、安装pip前需要前置安装setuptools
[root@bogon ~]# wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
[root@bogon ~]# tar zxvf setuptools-19.6.tar.gz
[root@bogon ~]# cd setuptools-19.6
[root@bogon ~]# python3 setup.py build
[root@bogon ~]# python3 setup.py install
2、安装pip
[root@bogon ~]# wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
[root@bogon ~]# tar zvxf pip-8.0.2.tar.gz
[root@bogon ~]# cd pip-8.0.2
[root@bogon pip-8.0.2]# python3 setup.py build
[root@bogon pip-8.0.2]# python3 setup.py install
原文地址:http://blog.51cto.com/11956937/2118778