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