- 切换到root用户
su
- 安装依赖
yum -y install zlib zlib-devel openssl-devel
- 下载安装Python
wget -c https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgz
tar zxvf Python-2.7.14.tgz
cd Python-2.7.14
./configure && make && make install
rm -f /usr/bin/python
ln -s /usr/local/bin/python /usr/bin/python
- 安装pip
wget -c https://bootstrap.pypa.io/get-pip.py
python get-pip.py
- 解决yum报错
vi /usr/bin/yum
将"#!/usr/bin/python"改为"#!/usr/bin/python2.6"