转载请注明来源:http://blog.youkuaiyun.com/greenlight_74110/article/details/78632406
先安装gcc zlib openssl 等包
下载源码
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
解压安装
tar -xvf Python-2.7.9.tgz -C /usr/src cd /usr/src/Python-2.7.9 ./configure --prefix=/usr/local/ --enable-shared CFLAGS=-fPIC make -j12 make altinstall
替换系统python
ls -l `which python python2 python2.6` rm /usr/bin/python ln -s -f /usr/local/bin/python2.7 /usr/bin/python
保持yum可用性
vim /usr/bin/yum #!/usr/bin/python 改为 #!/usr/bin/python2.6
安装pip
curl -O https://bootstrap.pypa.io/get-pip.py # 得到一个get-pip.py python get-pip.py Installing collected packages: pip, setuptools, wheel Successfully installed pip-7.1.0 setuptools-18.0.1 wheel-0.24.0