一、下载Python源码
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar xf Python-2.7.13.tgz
cd Python-2.7.13
二、编译
yum install openssl openssl-devel zlib zlib-devel libffi-devel libffi libxml2 libxml2-devel libxslt libxslt-devel tcl-devel tk-devel sqlite-devel
./configure --prefix=/usr/local --with-zlib-dir=/usr/lib64 --with-ensurepip=install --enable-loadable-sqlite-extensions
make
make altinstall # 不会覆盖系统默认python
三、安装easy_install
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python2.7 ez_setup.py
四、pip使用国内源
vi ~/.pip/pip.conf
[global]timeout = 6000index-url = http://mirrors.aliyun.com/pypi/simple/[install]use-mirrors = truemirrors = http://mirrors.aliyun.com/pypi/simple/trusted-host = mirrors.aliyun.com