Linux升级安装python2.7.5到python2.7.9
Linux升级安装python2.7.5到python2.7.9
背景介绍:Centos7默认python2的版本 为2.7.5。有的软件需要指定python2的小版本。这里以升级到python2.7.9为例。
一、升级到python2.7.9
0、安装依赖
yum groupinstall "Development tools" yum install -y gcc libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel libpcap-devel
1、获取安装包
cd ~ wget --no-check-certificate https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
2、解压安装
(1)解压
xz -d Python-2.7.9.tar.xz tar -xvf Python-2.7.9.tar
(2)安装
cd Python-2.7.9/ ./configure --prefix=/usr/local make && make install
3、建立快捷方式
cd ~ ln -s /usr/local/bin/python2.7 /usr/local/bin/python2.7.9 python2.7.9 -V ln -s /usr/local/bin/python2.7 /usr/local/bin/python python -V
4、使用测试
python -V
1 、下载pip2的get-pip.py文件
cd ~ wget https://sec.ly.com/mirror/get-pip.py --no-check-certificate
2、安装pip2
python get-pip.py
3、更新至最新
pip install -U pip
4、使用验证
pip -V
5、安装python应用程序的pip依赖
pip install -r xxx.txt