[Experience] linux install python (replacement system comes with python version)

Whether or redhat linux systems centos, will bring their own python2.

Perhaps your application requires python3, it is divided into two cases, one abandoned own python, own re-install the new version, but can cause system errors of some wonderful work, and this method back to cause some users need to use python2 .

Another way is two versions, or multiple versions co-exist, it is not difficult. Between Benpian is the first to explain the method, the second method free update. Available .... you know, a good mood, ha ha.

Next, is step by step road, easy to learn:

 

step1. Download source packages, the download link directly to the back of the python official website, if you want to install a later version of the replaceable

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

2. Extract the archive

 1 tar xvf Python-2.7.10.tgz 

 

3. Specify the installation path

 1 cd Python-2.7.10 2 ./configure --prefix=/usr/local/python2.7.10 

 

4. Compile and install

make
make install

 

5. Create a link pointing to the python version 2.7

1 rm -f /usr/bin/python
2 ln -s /usr/local/python2/bin/python /usr/bin/python

 

6. The place, old-fashioned, steady approach is to download the pip, settools installation package, then python pip.X.tar install

The new approach is to download get-pip.py, then automatically installed:  https://bootstrap.pypa.io/get-pip.py

1 python get-pip.py

 

Vintage:

1 wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
2 wget https://pypi.python.org/packages/84/08/c01703c62d4eda7ae0c38deeb8adb864d0c90367a4c3e4299b917ac88a39/setup-tools-36.0.1.zip
3 
4 tar xvf pip-9.0.1.tar.gz
5 unzip setup-tools-36.0.1.zip 

 

1 execution fails on the first execution python bootstrap.py, then perform setup.py Python install 
2  
3  install pip After a successful installation, enter pip directory, execute python setup.py install install pip
 4  
5 cd PIP- 9.0 . 1 
6 Python setup.py install

 

1 ln -s /usr/local/python2/bin/pip /usr/bin/pip
2 pip

 

Completed, sleeping, MD, has been 2:00, the heart tired ~

Guess you like

Origin www.cnblogs.com/xk-bench/p/12185311.html