CentOS 6.7 (the system comes Python2.6.6) upgrade and install python 2.7 pip

First, upgrade python 2.7

1. Install the appropriate upgrade package

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

2. Download python 2.7 source package and extract to the relevant directory

cd /root/Download/
wget http://mirrors.sohu.com/python/2.7.6/Python-2.7.6.tgz
tar zxf Python-2.7.6.tgz -C /usr/local/src/

3. Install

cd /usr/local/src/Python-2.7.6/  
./configure --prefix=/usr/local/python2.7
make && make install

4. Configure

mv /usr/bin/python /usr/bin/python.bak  
ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python

5. View version

python -V

Display: Python 2.7.6

Two assembling pip

2.1 setuptools installation

wget --no-check-certificat  https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz
tar zxf setuptools-2.0.tar.gz
cd setuptools-2.0
python setup.py install

2.2 pip installation

wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz --no-check-certificate
tar -xzvf pip-1.3.1.tar.gz
cd pip-1.3.1
python setup.py install

2.3 modify environment variables

vi /etc/prifile

In the last export PATH rearmost row added: /usr/local/python2.7/bin below:

Save and exit
so that just set the environment variable to take effect, run

source /etc/profile

an examination

The installation is complete

Guess you like

Origin blog.csdn.net/a857553315/article/details/84978344
Recommended