Although this is not difficult, but because of Linux is not familiar with the company's computer has limited the download of some resources, took a lot of detours. This article is verified to be available.
Original: CentOS Installation python3.5.2
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
Tar xzf pip-8.1.2.tar.gz
CD PIP-8.1.2/
Python2 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
Tar xzf setuptools-25.2.0.tar.gz
CD setuptools-25.2.0/
Python3 setup.py Install
Finally, we suggest finished processing dependencies forsetuptools==25.2.0
The installation Setuptools successful
Go back to pip-8.1.2 directory
Perform python3 setup.py install installation
Finally prompts finished processing dependencies for pip==8.1.2
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)