#tar -xf Python-2.7.9.tar.xz
#cd Python-2.7.9
#mkdir /usr/local/python27
#./configure --prefix=/usr/local/python27
#make
#make install
如果此时出现找不到所依赖的模块可先不必管它
#mkdir /usr/local/python26
#mv /usr/bin/python /usr/local/python26
将原来的python文件备份到python26文件夹下
#ln -s /usr/local/python27/bin/python2.7 /usr/bin/python
将编译后bin文件夹下的python2.7 链接到 /usr/bin/python位置上
# python –v
查看python版本,此时已升级到2.7
解决升级后的centos无法使用yum
#vim /usr/bin/yum
把最头部的:
#!/usr/bin/python
改成:
#!/usr/bin/python2.6