CentOS6.9升级python2.6至2.7

Z先森 2018-11-08 PM 1348℃ 0条

安装依赖:

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

安装python2.7:

wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar -zxvf Python-2.7.13.tgz
cd Python-2.7.13
./configure --prefix=/usr/local
make && make altinstall
rm -f /usr/bin/python
#然后编辑/usr/bin/yum,将第一行的#!/usr/bin/python修改成#!/usr/bin/python2.6
ln -s /usr/local/bin/python2.7 /usr/bin/python

查看版本:

python -V

安装pip2.7:

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
ln -s /usr/local/bin/pip2.7 /usr/bin/pip
标签: python, pip, yum

如无特殊说明,本博所有文章均为博主原创。

评论啦~