查看python的版本python
python -V Python 2.6.6
下載新版本python2.7
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
解壓code
tar -xvf Python-2.7.12.tgz
安裝ip
cd Python-2.7.12 ./configure --prefix=/usr/local/python2.7 make all make install make clean make distclean
查看安裝後python版本get
/usr/local/bin/python2.7 -V Python 2.7.12
創建軟鏈接pip
mv /usr/bin/python /usr/bin/python2.6.6 ln -s /usr/local/bin/python2.7 /usr/bin/python
從新檢驗Python 版本ftp
python -V
解決系統 Python 軟連接指向 Python2.7 版本後,由於yum是不兼容 Python 2.7的下載
vi /usr/bin/yum # 修改 python 指向 #!/usr/bin/python -> #!/usr/bin/python2.6.6
先安裝setup-toolsyum
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificate chmod +x setuptools-0.6c11-py2.7.egg sh setuptools-0.6c11-py2.7.egg
安裝piptools
wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz --no-check-certificate cp pip-1.3.1.tar.gz /usr/src/ tar zxvf pip-1.3.1.tar.gz cd pip-1.3.1 python setup.py install ln -s /usr/local/python2.7/bin/pip /usr/bin/pip