Python3.7.3 installation (Ubuntu16.04)

Python3.7.3 installation (Ubuntu16.04)

        Previous article has introduced the installation Python2 and Python3 on Windows, and now describes installation on Linux systems. Default Ubuntu16.04 installed Python2.7 and Python3.5, on Redhat and CentOS default installation Python2.7, attention, regardless of whether we want to use the default installed version, do not uninstall the default Python. Ubuntu, Redhat, CentOS the use accounted for most Python developers use on these systems can be installed directly using the default version of Linux system release, but sometimes we need to specify the version, such as Redhat no Python3, using the Django framework of the latest LTS version Django2. 2 or later required Python3.6 etc. does not meet our needs in the default version, you need to install our own, so this article is to introduce steps Python3.7.3 installed on Ubuntu16.04, other versions of the installation steps similar.

 

First, download the Ubuntu package Python3.7.3

1. Baidu search Python, Python find the official website, click into https://www.python.org/

2. Click Downloads Python official website, and then in the drop-down menu midpoint Source code, enter the version selection page

3. Select the version to enter the page, you can see the latest version and the latest version of Python3 Python2 at the top, click here Python3.7.3 download page (if you need to download other versions can scroll down the page, choose the version they need )

4. After the download page, scroll down to find the "Files", here are the different operating systems Python3.7.3 version of the installation package or related documentation, which is installed in Ubuntu download Gzipped source tarball, click to download, wait a It will be completed can be downloaded

 

Second, the installation on Ubuntu Python3.7.3

1. Download the complete Python3.7.3 installation package store in Windows, find the installation package, copied to the desktop Ubuntu virtual machine (hold the desktop can, but this is more convenient), open a terminal, cd Desktop into the desktop, you can see copied Python-3.7.3 installation package

2. To start the installation now Python, and we should first find the installation directory, Linux has a directory / usr / in the root directory, is an abbreviation for Unix Software Resource (Unix operating system software resources), this directory is equivalent to the Windows operating system. " C: \ Windows \ "and" C: \ Program files \ "directory of both complexes, it is generally to install the software under that folder and desktop software installation package moved to / usr / down, in need. preceded by sudo with root privileges

3. in the / usr / directory, unzip Python3.7.3 installation package, placed in the current directory   

4. You can now start the installation, but because there are other versions of Ubuntu by default already Python3 of the conflict if the direct path of the installation file will cause an error during installation,

(Makefile:1092: recipe for target 'libinstall' failed

make: *** [libinstall] Error 1), so we Python3.7.3 alone to create an installation directory, cd / usr / local /, create the installation directory python3.7 in / usr / local

5. Once you've created the installation directory, back under decompression good Python-3.7.3 directory, you can see there are a green executable files configure, execute configure and specify the file prefix for the installation directory we just created the / usr / local / python3.7

6. Enter execution, which is the first step in the installation of the source code, will be installed on Python3.7.3 be configured to check whether the current environment to satisfy dependencies to be installed. Wait a minute, wait for the end of execution

7. You can see that, now more than a Makefile file in Python-3.7.3, which is compiling the file, execute the command sudo make start compiling

8. Compile time will be slightly longer, about 3-5 minutes, patiently waiting for the end

9. After the compilation is complete, continue to enter sudo make install to install, here requires root privileges, enter execute the command to start the installation. (Many people prefer to perform together directly make & make install, build and install, this is the same, performed separately just to better locate problems when problems arise)

10. If an error during installation: ModuleNotFoundError: No module named '_ctypes', before the following command: sudo apt-get install --reinstall zlibc zliblg zliblg-dev

11. wait for execution is completed, then execute: sudo apt-get install libffi-dev libssl-dev libreadline-dev -y, after the execution is completed, re-execute sudo make install

12. Wait two minutes, no error will perform the complete installation was successful

13. Now we cd to the installation directory specified in /usr/local/python3.7/, which now has more than four bin directory, cd to the bin directory, you can see that there are other documents python3 and python3.7 Executive ./python3 python open in the current directory, you can enter the python3.7.3, enter print ( "hello python!"), Python interpreter prints hello python! test is successful, then explain python3.7.3 been installed successfully

 

Third, create Python3.7.3 soft link to / usr / bin /

Python3.7.3 1. After installation is complete, we python3 specify the installation directory /usr/local/python3.7/bin can enter python3.7.3, but the input python3 in other locations (such as Desktop), before it is entered python version

2. The reason is that when we enter the command, the system will go to / usr / bin /, / usr / local / bin /, / usr / sbin /, / usr / local / sbin and other directory to find out whether there is the executable file, now under / usr / bin has been python3, python3.4, python3.5 three files, and these three documents is a pointer to the previously installed other versions of Python, so a direct input python3, entered not Python3.7.3

3. Now we are created in the / usr / bin / python3.7 soft links and python37, pointing Python3.7.3 we installed, and then execute python27 or python3.7 anywhere in this Ubuntu virtual machine is to enter Python3. 7.3

 

      Up to now, on Ubuntu you can normally use the latest version of Python3.7.3 Python3, you can begin to develop a python.

Released nine original articles · won praise 459 · views 160 000 +

Guess you like

Origin blog.csdn.net/songhait/article/details/96300982