下載python最新版本2.7.13並編譯安裝
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.13.tar.xz xz -d Python-2.7.13.tar.xz tar xf Python-2.7.13.tar cd Python-2.7.13 ./configure --prefix=/usr/local/python-2.7.13 make make install
Python-2.7.13 會安裝在 /usr/local/python-2.7.13 目錄下
系統自帶的 Python 是在 /usr/bin 目錄下
ll -tr /usr/bin/python* /usr/bin/python2.6-config /usr/bin/python2.6 /usr/bin/python /usr/bin/python2 -> python /usr/bin/python-config -> python2.6-config
更新系統默認 Python 版本
備份舊的python
mv /usr/bin/python /usr/bin/python2.6.6 mv /usr/bin/python-config /usr/bin/python2.6-config ln -s /usr/local/python-2.7.13/bin/python2.7 /usr/bin/python ln -s /usr/local/python-2.7.13/bin/python-config /usr/bin/python-config ln -s /usr/local/python-2.7.13/bin/python2.7 /usr/bin/python2.7
查看新的 Python 版本
python --version Python 2.7.13
修改yum
vim /usr/bin/yum
將開頭的python改成python2.6
為新版 Python 安裝 setuptools
wget https://bootstrap.pypa.io/ez_setup.py -O - | python curl -O -L https://pypi.python.org/packages/a9/23/720c7558ba6ad3e0f5ad01e0d6ea2288b486da32f053c73e259f7c392042/setuptools-36.0.1.zip#md5=430eb106788183eefe9f444a300007f0 unzip setuptools-36.0.1.zip#md5\=430eb106788183eefe9f444a300007f0 cd setuptools-36.0.1 python setup.py install ln -sv /usr/local/python-2.7.13/bin/easy_install /usr/bin/easy_install /usr/local/python-2.7.13/bin/easy_install pip ln -sv /usr/local/python-2.7.13/bin/pip /usr/bin/pip pip list
接下來就可以用pip來安裝軟件了