Linux environment already exists Python2, do not uninstall the existing python2 in the system, otherwise it will cause many other programs in the system to be executed by Python exception
To view the installation path for Python2: which Python2
To view the installation path for Python3: which Python3
Python3 Installation Method:
First switch to the path you want to download, under Execute the following command
[Email protected]~]# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
[Email protected]~]# tar-zxf python-3.6.5.tgz
[[Email protected]~]# CD Python-3.6.5
There is a Readme file in the installation package, there is write how to install
[[email protected] python-3.6.5]# ls
[Email protected] python-3.6.5]# ./configure
[[email protected] python-3.6.5]# make
[[email protected] python-3.6.5]# make test
[[email protected] python-3.6.5]# make install
Install it, then open python3.6
[Email protected] python-3.5.2]# Python3
Python 3.6.5 (Default, Mar 25 2018, 13:46:07)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on Linux
Type "Help", "copyright", "credits" or "license" for more information.
>>>
Linux./configure, make, make test/make check, sudo make install function
- Config/configure/configure
- This is used to detect the target characteristics of your installation platform. For example, it detects if you have CC or GCC, does not need CC or GCC, it is a shell script
- This step is generally used to generate Makefile, to prepare for the next compilation, you can control the installation by adding parameters after the Configure, such as:
- ./configure--PREFIX=/USR
- The above means that the software is installed in/usr below
- The execution file will be installed in/usr/bin (not the default/usr/local/bin)
- The resource file will be installed in/usr/share (not the default/usr/local/share)
- At the same time some software configuration files can be set by specifying the--sys-config= parameter
- There are also such parameters as:--with 、--enable 、--without 、--disable and so on, you can control the compilation with the./configure--help to see detailed instructions to help
- Make
- This step is compiled, it reads the instruction from the makefile, and then compiles the
- This step is compiled, and most of the source code packages are compiled in this step
- Of course, some perl or Python-written software needs to call Perl or Python to compile
- If error occurs during the make process, you need to write down the error code (note that it is not just the last line), and then you can submit a bugreport to the developer (usually with a submit address in the INSTALL), or your system will have fewer dependent libraries, which requires careful study of the error code.
- Make Test/make Check
- As the name implies, this step is to check the previous make, to ensure there is no error, that is, this step of test, check to all OK, error 0
- sudo make install
- This step is for installation, it also reads instructions from makefile, installs to the specified location
- This command to install, generally requires that you have root permissions (because you want to write to the system file), so the previous use of sudo
Installing Python3 in a Linux environment