centos6.8 升级python到2.7

[root@bogon ~]# cat /etc/redhat-release 
CentOS release 6.8 (Final)
[root@bogon ~]# wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
[root@bogon ~]# tar zxf Python-2.7.15.tgz 
[root@bogon ~]# cd Python-2.7.15
[root@bogon Python-2.7.15]# ./configure
[root@bogon Python-2.7.15]# make && make install
[root@bogon Python-2.7.15]# /usr/local/bin/python2.7 --version
Python 2.7.15
[root@bogon Python-2.7.15]# mv /usr/bin/python /usr/bin/python2.6.6
[root@bogon Python-2.7.15]# ln -s /usr/local/bin/python2.7 /usr/bin/python
[root@bogon Python-2.7.15]# python --version
Python 2.7.15
[root@bogon Python-2.7.15]# vim /usr/bin/yum 
#!/usr/bin/python     ——>     #!/usr/bin/python2.6.6
[root@apply1 Python-2.7.15]# pip --version
Traceback (most recent call last):
  File "/usr/bin/pip", line 7, in
    from pip import main
ImportError: No module named pip
[root@apply1 Python-2.7.15]# find  / -name pip
/usr/lib/python2.6/site-packages/pip
/usr/bin/pip
[root@apply1 Python-2.7.15]# cp -r /usr/lib/python2.6/site-packages/pip /usr/local/lib/python2.7/site-packages/
[root@apply1 Python-2.7.15]# pip -V
pip 9.0.3 from /usr/local/lib/python2.7/site-packages (python 2.7)
 

你可能感兴趣的:(Python)