centos7里默认python升级到2.7.11
CentOS镜像使用帮助 http://mirrors.163.com/.help/centos.html
安装gcc
yum install gcc* openssl openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel python-devel zlib
下载安装包
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tar.xz.asc
解压
xz -d Python-2.7.11.tar.xz
tar zxvf Python-2.7.11.tar
安装
cd Python-2.7.11
./configure --prefix=/usr/local
make && make install
将老版本python更换
mv /usr/bin/python /usr/bin/python2.7.5
更换默认python
export PATH="/usr/local/bin:$PATH"
或者
ln -s /usr/local/bin/python2.7 /usr/bin/python
下载setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
安装setuptools
tar -xvf setuptools-1.4.2.tar.gz
cd setuptools-1.4.2
python setup.py install
下载安装pip
wget https://bootstrap.pypa.io/ez_setup.py
python get-pip.py
#修改 yum中的python 将#!/usr/bin/python改为 #!/usr/bin/python2.7.5
vim /usr/bin/yum