Python2.6升级2.7

获取Python2.7版本的源码包
https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz

Python2.7安装

tar xvzf Python-2.7.8.tgz
cd Python-2.7.8
./configure --prefix=/usr/local
make && make install

拷贝Python头文件

cd /usr/local/include/python2.7
cp -a ./* /usr/local/include/

备份旧版本的python并链接新版本的python

cd /usr/bin
mv python python24
ln -s /usr/local/bin/python2.7 /usr/local/bin/python
rm -f /usr/bin/python 
cp /usr/local/bin/python2.7 /usr/bin/python

* 修改yum脚本,使其指向旧版本的python,已避免其无法运行*

 

vim /usr/bin/yum
    #!/usr/bin/python  -->  #!/usr/bin/python2.6

 

posted @ 2018-07-05 12:27  努力乄小白  阅读(274)  评论(0编辑  收藏  举报