Source code compiler installation Python3
Install the necessary tools yum-utils, its function is to manage the repository and the expansion pack of tools (mainly for repository)
$ sudo yum install yum-utils
Yum-builddep constructed using Python3 environment, install the missing software dependency, the following command is handled automatically.
$ sudo yum-builddep python
After the download is complete Python3 source package (author Python3.5 for example), Python source package directory: HTTPS : //www.python.org/ftp/python/, as of the latest version of Bo made the day Python3 for 3.7.0
$ Curl -The https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
The final step, compile and install Python3, the default installation directory is / usr / local if you want to change the other directory can be used configure before compiling (make) command appends parameters "-prefix = / alternative / path" to complete the changes.
$ tar xf Python-3.5.0.tgz $ cd Python-3.5.0 $ ./configure $ make $ sudo make install
At this point you have in your CentOS system successfully installed python3, pip3, setuptools, python version View
$ Python3 -V
If you want to use as the default version Python3 python, you need to modify the bashrc file, add the line alias parameters
alias python='/usr/local/bin/python3.5'
Because CentOS 7 is recommended not to move / etc / bashrc file, but the user-defined configuration into /etc/profile.d/ directory, specific methods
we /etc/profile.d/python.sh
Input parameters alias alias python = '/ usr / local / bin / python3.5', save and exit
If the file is created non-root user needs to pay attention to set permissions
chmod 755 /etc/profile.d/python.sh
Restart session configuration to take effect
source /etc/profile.d/python.sh