Before you install environment
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
Download python package
URL: https: //www.python.org/downloads/release/python-365/
Download: https: //www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
The files in the / user / local in
root@bogon local]# pwd
/user/local
[root@bogon local]# ll Python-3.6.5.tgz
-rw-r--r--. 1 root root 22994617 Mar 28 2018 Python-3.6.5.tgz
configure
This step is generally used to generate a Makefile, in preparation for the next compilation, you can add parameters to control the installation after configure, such as code:
./configure --prefix=/user/local
The above means that the software is installed in / usr below, the executable file will be installed in / usr / bin (instead of the default / usr / local / bin), the resource file will be installed in / usr / share (instead of the default the / usr / local / share).
Meanwhile, some software configuration file you can set by specifying --sys-config = parameter. Some software can also add --with, - enable, - without, - disable etc. parameters to control compiler, you can view detailed instructions to help by allowing ./configure --help.
make
This step is to compile the source code for most of the packages have been compiling this step (of course, some written in perl or python perl or python software needs to be called to compile).
If the error occurs in the make process, you have to write down the error code (note not just the last line), then you can submit a bugreport to the developer (generally submitted to the address in the INSTALL years), or your system less dependent on a number of libraries, which require careful study of their own error code.
The role of make is to start compiling the source code, and some offer features, these features provide related functions by his Makefile settings file, such as make install general representation of the installation, make uninstall is to uninstall, no arguments is the default location to source code compilation.
make a Linux development kit inside a control program for automated compilation, automated call him by compiling specifications by means of the Makefile written in gcc program, ld and run certain programs need to be compiled. In general, the Makefile control codes used by him, provided the script generated by the configure parameters and the given system environment.
make install
This command to install (of course, some software you need to run make check or make test carried out some tests), this step generally requires you to have root privileges (because want to write to the file system)
Make soft link:
[root@bogon tmp]# ln -s /user/local/python3/bin/python3 /usr/bin/python3
[root@bogon bin]# ll python*
lrwxrwxrwx. 1 root root 7 Jun 27 10:40 python -> python2
lrwxrwxrwx. 1 root root 9 Jun 27 10:40 python2 -> python2.7
-rwxr-xr-x. 1 root root 7216 Jun 21 04:28 python2.7
-rwxr-xr-x. 1 root root 1835 Jun 21 04:27 python2.7-config
lrwxrwxrwx. 1 root root 16 Jun 27 10:40 python2-config -> python2.7-config
lrwxrwxrwx. 1 root root 30 Jun 26 16:01 python3 -> /usr/local/python3/bin/python3
lrwxrwxrwx. 1 root root 14 Jun 27 10:40 python-config -> python2-config
So that you can directly use the python3
[root@bogon bin]# python3
Python 3.6.5 (default, Jun 26 2019, 15:52:58)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.