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