CentOS6默认的python2.6.6升级到python2.7.10

时间:2022-01-14 12:47:47

1.下载解压

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

tar -zxvf Python-2.7.10.tgz

yum install readline-devel zlib-devel openssl-devel gcc

2.编译安装

cd Python-2.7.10

./configure --prefix=/usr/local/python2.7

make

make install

3.添加软连接和修改yum

mv /usr/bin/python /usr/bin/python2.6.6

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

vi /usr/bin/yum

#!/usr/bin/python 修改为 #!/usr/bin/python2.6.6

4.安装easy_install和pip

wget https://pypi.python.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip

unzip distribute-0.7.3.zip 

cd distribute-0.7.3

python setup.py install

/usr/local/python2.7/bin/easy_install pip

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

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