Python2.6升级到2.7

[root@iZu18qlblzrZ shadowsocks-2.9.1]#
[root@iZu18qlblzrZ shadowsocks-2.9.1]# python -V
Python 2.6.6
[root@iZu18qlblzrZ shadowsocks-2.9.1]# wget -c https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz

[root@iZu18qlblzrZ shadowsocks-2.9.1]# tar zxvf Python-2.7.13.tgz

[root@iZu18qlblzrZ Python-2.7.13]# cd Python-2.7.13

[root@iZu18qlblzrZ Python-2.7.13]# ./configure
[root@iZu18qlblzrZ Python-2.7.13]# make all
[root@iZu18qlblzrZ Python-2.7.13]# make install

[root@iZu18qlblzrZ Python-2.7.13]# /usr/local/bin/python2.7 -V
Python 2.7.13

[root@iZu18qlblzrZ Python-2.7.13]# ln -s /usr/local/bin/python2.7 /usr/bin/python
ln: creating symbolic link `/usr/bin/python': File exists
[root@iZu18qlblzrZ Python-2.7.13]# mv /usr/bin/python /usr/bin/python2
python2 python2.6
[root@iZu18qlblzrZ Python-2.7.13]# mv /usr/bin/python /usr/bin/python2
python2 python2.6
[root@iZu18qlblzrZ Python-2.7.13]# mv /usr/bin/python /usr/bin/python2.6.6
[root@iZu18qlblzrZ Python-2.7.13]# ln -s /usr/local/bin/python2.7 /usr/bin/python
[root@iZu18qlblzrZ Python-2.7.13]# python -V
Python 2.7.13
[root@iZu18qlblzrZ Python-2.7.13]#

测试yum

[root@iZu18qlblzrZ Python-2.7.13]# yum install lrzsz
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

No module named yum

修改/usr/bin/yum : #!/usr/bin/python -> #!/usr/bin/python2.6.6

[root@iZu18qlblzrZ Python-2.7.13]# vi /usr/bin/yum

#!/usr/bin/python2.6.6
import sys

 

未经允许不得转载:ganlei的个人博客 » Python2.6升级到2.7

赞 (5)
分享到:更多 ()