1、下載Python源碼python
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgzsql
tar xf Python-2.7.13.tgzbootstrap
cd Python-2.7.13bash
2、編譯python2.7
yum install openssl openssl-devel zlib zlib-devel libffi-devel libffi libxml2 libxml2-devel libxslt libxslt-devel tcl-devel tk-devel sqlite-develurl
./configure --prefix=/usr/local --with-zlib-dir=/usr/lib64 --with-ensurepip=install --enable-loadable-sqlite-extensionssqlite
makexml
make altinstall # 不會覆蓋系統默認pythonblog
3、安裝easy_installip
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python2.7 ez_setup.py
4、pip使用國內源
vi ~/.pip/pip.conf
[global] timeout = 6000 index-url = http://mirrors.aliyun.com/pypi/simple/ [install] use-mirrors = true mirrors = http://mirrors.aliyun.com/pypi/simple/ trusted-host = mirrors.aliyun.com