centos6 python2.6.6升python2.7.15

1,下载源代码

wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz

2,解压

tar -zxvf Python-2.7.12.tgz

3,切换目录

cd Python-2.7.15

4,编译安装

./configure
make all
make install
make clean
make distclean

5,使系统默认指向python2.7

#mv /usr/bin/python /usr/bin/python2.6.6
#ln -s /usr/local/bin/python2.7 /usr/bin/python

6,yum是不兼容 Python 2.7的 解决办法

#vi /usr/bin/yum
将文件头部的
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6