centos6原生python2.6升级python2.7

时间:2022-06-28 08:35:20

首先下载python2.7压缩包


wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

然后解压


tar -zxvf Python-2.7.3.tgz

创建一个新的路径存放解压编译文件


mkdir /usr/local/python


然后编译安装


./configure --prefix=/usr/local/python
make
make install


为了避免链接重复,先备份一下之前的程序


mv /usr/bin/python /usr/bin/python_old

最好创建链接


ln -s /usr/local/python27/bin/python2.7 /usr/bin/python

升级成功了!


centos6原生python2.6升级python2.7