This article takes the installation python3.5.2 as an example
1. Download from Python website
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
2, decompression python-3.5.2.tgz
Tar xzf python-3.5.2.tgz
3, the configuration compiles installs the Python3
To install the libraries required by Python:
Yum-y install gcc gcc-c++ openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
CD PYTHON-3.5.2/
To configure, put the directory of the installed Python 3.5.2 in the/usr/local/python3.5
./configure--prefix=/usr/local/python3
Execute echo $ After completion 0 The configuration has no errors, continue with the next compilation
Make-j2
Execute echo $ after completion 0 The compilation has no errors, proceed to the next installation
Make Install-j2
ls/usr/local/python3/bin/python3.5
When you see this file, add it to the variable in the form of a soft link.
Ln-s/usr/local/python3/bin/python3.5/usr/bin/python3
Ls/usr/local/python3/bin/pip3
There are two situations where, if this file is present, go directly to (2):
(1) If the hint does not have this file, you need to compile the PIP3 to install up
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/ Pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9-o pip-9.0.1.tar.gz
Tar xzf pip-9.0.1.tar.gz
CD PIP-9.0.1/
Python3 setup.py Install
If you receive the following prompt:
Traceback (Mostrecent call last):
File "setup.py", line 6, in<module>
From Setuptools import Setup, find_packages
Importerror:nomodule named Setuptools
You need to install Setuptools First, then install PIP
wget https://pypi.python.org/packages/a0/85/24d3b6b331b056180f28ce19658a515364dca58aa9e88eff2ac39bf825f2/ Setuptools-25.0.0.tar.gz#md5=615d7c98ea77f816a72d0d1f4401f311-o setuptools-25.0.0.tar.gz
Tar xzf setuptools-25.0.0.tar.gz
CD setuptools-25.0.0/
Python3 setup.py Install
Finally, we suggest finished processing dependencies forsetuptools==25.0.0
The installation Setuptools successful
Go back to pip-9.0.1 directory
Perform python3 setup.py install installation
Finally prompts finished processing dependencies for pip==9.0.1
The PIP installation was successful
LS View Confirmation
Ls/usr/local/python3/bin/pip3
(2) The hint has this file, then uses the soft link the form to add to the variable inside
Ln-s/USR/LOCAL/PYTHON3/BIN/PIP3/USR/BIN/PIP3
4, verify the installation
Enter the Python3 command, and the following success occurs
Python 3.5.2 (default, Aug 31 2016, 07:34:34)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on Linux
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>>
Enter the Pip3-v command, and the following success occurs
Pip 8.1.1 from/usr/local/python3/lib/python3.5/site-packages (Python 3.5)