-------------

Originally planned to use pyenv, but the company's network is not strong and can't be downloaded, and even 15M things can't be downloaded. . . . Do not say,,, have kneeled! ! !

=====================================

Had to manually install and configure it bit by bit. . . . record.



python2.7.10 installation configuration document

download:

wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz

Environment required for installation:

yum install readline-devel -y #If python2.7.10 is not installed, the backspace key cannot be used normally after installation, etc.

Install:

1
2
3
4
5
6
  tar  xf Python-2.7.10.tgz
   cd  Python-2.7.10
   . /configure
   make  all
   make  install 
   cd  ../

The default installation location is /usr/local/bin, /usr/local/lib/python2.7


Configure python2.7.10

1
2
mv  /usr/bin/python  /usr/bin/python2 .6.6
ln  /usr/local/bin/python2 .7  /usr/bin/python

test:

1
2
python -V
#Python 2.7.10

Configure the yum command so that yum still uses the original python version

Modify /usr/bin/yum

vim /usr/bin/yum

Change /usr/bin/python to /usr/bin/python2.6.6


install pip

  At this time, yum cannot be used to install python plugins, it will be installed in /usr/lib/python2.6/site-packages/ by default, so it cannot be used normally after installation

  First configure the environment required by python to install the plugin;

  Install setuptools

    download:

wget https://pypi.python.org/packages/source/s/setuptools/setuptools-18.2.tar.gz#md5=52b4e48939ef311d7204f8fe940764f4

1
2
3
   tar  xvf setuptools-18.2. tar .gz
   cd  setuptools-18.2
   python setup.py  install  ##此时的python 命令版本:2.7.10

  Let's install pip

download pip 

  wget https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz#md5=3823d2343d9f3aaab21cf9c917710196

1
2
3
   tar  xf pip-7.1.2. tar
   cd  pip-7.1.2
   python setup.py  install

至此pip已安装完成,可以正常使用.

# pip -V

pip 7.1.2 from /usr/local/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg (python 2.7)


配置pip使用豆瓣的源

1
2
3
4
5
6
mkdir  ~/.pip  #如果不存在就创建
   vim ~/.pip /pip .conf
   添加如下内容:
   [global] 
   index-url = http: //pypi .douban.com /simple 
   trusted-host = pypi.douban.com

至此pip配置完毕,可以正常使用pip来安装python的插件了。比如Ipython

pip install ipython

插件安装位置与python 2.7.10的目录下 --> /usr/local/lib/python2.7/site-packages