python 版本升级(CentOS) 从2.6.6升级到2.7.6

 

安装必须的包

yum install zlib-devel bzip2-devel pcre-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel

 

下载安装2.7.x版本Python 

1 wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.bz2

2 tar xvf Python-2.7.6.tar.bz2

3 cd Python-2.7.6

4 ./configure --prefix=/usr/local

5 make && make altinstall

 

 移除2.6版本的链接

mv /usr/bin/python /usr/bin/python2.6.bak

建立新版本链接

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

 

安装easy_install

wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz

tar xf distribute-0.6.49.tar.gz

cd distribute-0.6.49

python setup.py install

ln -s /usr/local/python2.7/bin/easy_install /usr/bin

easy_install --version

 

安装pip

easy_install pip

ln -s /usr/local/python2.7/bin/pip /usr/bin

pip --version

 

 

解决Yum使用旧版2.6问题

sed -i '1c #!/usr/bin/python2.6' /usr/bin/yum

 

你可能感兴趣的:(python)