centos6.3升级python到2.7(删除旧版本)

作者:袖梨 2022-06-30

centos6.3升级python到2.7

yum groupinstall "Development tools" -y
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel -y

cd /tmp
wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make && make altinstall

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

which python


wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
/usr/local/bin/python2.7 ez_setup.py
/usr/local/bin/easy_install-2.7 pip
which pip
which easy_install

删除旧的

/usr/bin/pip --version
/usr/bin/easy_install --version

cd /usr/local/bin
mv pip pip2.6
mv easy_install easy_install-2.6
ln -s pip2.7 pip
ln -s easy_install-2.7 easy_install


cd /usr/bin/
mv pip pip.old
mv pip2 pip2.old
mv pip2.6 pip2.6.old

mv easy_install easy_install.old
mv easy_install-2.6 easy_install-2.6.old

更新PIP

pip install --upgrade pip

新的python都被装到 /usr/local/bin/ 下。

总得来讲上面其实没有删除旧版本了而进行了更名备份了,这个就是linux内核系统的一个优势了软件是可以进行更名的并不需要删除或注册表什么东西的。

相关文章

精彩推荐