1.安装升级GCC
yum install gcc* openssl openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel python-devel zlib
2.下载python安装包
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tar.xz
3.解压
xz -d Python-2.7.11.tar.xz
tar -xvf Python-2.7.11.tar
4.编译安装
cd Python-2.7.11
./configure --prefix=/usr/local
make && make install
5.将老版本python更换
mv /usr/bin/python /usr/bin/python2.7.5
6.更换默认python
export PATH="/usr/local/bin:$PATH"
或者
ln -s /usr/local/bin/python2.7 /usr/bin/python
7.下载setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
8.安装setuptools
tar -xvf setuptools-1.4.2.tar.gz
cd setuptools-1.4.2
python setup.py install
9.下载安装pip
wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificatepip 安装命令为:
tar -xzvf pip-1.5.4.tar.gz
cd pip-1.5.4
python setup.py install
pip install --upgrade pip升级
10.#修改 yum中的python 将#!/usr/bin/python改为 #!/usr/bin/python2.7.5
vim /usr/bin/yum