首页 > 代码库 > Linux 下升级python

Linux 下升级python

----记录一下,不每次都去网上找了;

1.下载安装包;

wget http://python.org/ftp/python/2.7.4/Python-2.7.8.tgz

2.解压

tar jxvf Python-2.7.8.tar.bz2

3.make, 需要安装gcc

cd Python-2.7.8

----

./configure //此时为默认安装路径,/usr/lib/python2.7

./configure --prefix=/usr/local/python2.7.4 //安装到想要安装的目录;需要事先建立目录;

make && make install
4,修改原有python版本
mv /usr/bin/python /usr/bin/python2.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
 
5,修复yum所使用版本;
vim /usr/bin/yum;将首行改为!#/usr/bin/python2.6

 

Linux 下升级python