Home > Article > Backend Development > How to install Python 3.7 on Debian 9?
Python is one of the most popular programming languages in the world and is a versatile programming language; it is simple and easy to learn, and we can use it to complete any operation we want, write small scripts, build games, develop websites, etc. wait. Python 3.7 is the latest major version of the Python language. The following article will introduce how to install the Python 3.7 version on the Debian system. I hope it will be helpful to everyone.
Building Python 3.7 on Debian is a relatively simple process and shouldn't take long.
1. First install the packages required to build the Python source:
$ sudo apt update $ sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
2. Use the curl command from python Download the source code of the required version on the download page
The following command is to download the Python 3.7.3 version:
$ curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
3. After the download is completed , use the tar command to decompress:
$ tar -xf Python-3.7.3.tar.xz
4. Navigate to the python source directory and run the configure script
The configure
The script will perform a number of checks to ensure that all dependencies on the system are present.
$ cd Python-3.7.3 $ ./configure --enable-optimizations
Description: The --enable-optimizations
option will optimize the Python binary by running multiple tests, which will make the build process slower.
5. Run make to start the build process:
$ make -j 8
In order to shorten the build time, you need to modify it according to the processor -j
flag. If you don't know the core number of your processor, you can find it by typing nproc
. This article takes 8 cores as an example, and uses the -j8
flag.
6. Install the python binary file
After the build is completed, run the following command as a user with sudo access to install the python binary file :
$ sudo make altinstall
Note: Do not use the standard make install as it will overwrite the default python3 system d binary.
7. Verification
At this point, Python 3.7 has been installed on the Debian system and can be used. We can enter the following command to verify it:
$ python3.7 --version
Output
Python 3.7.3
Recommended related video tutorials: "Python3 Tutorial"
The above is The entire content of this article is hoped to be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !
The above is the detailed content of How to install Python 3.7 on Debian 9?. For more information, please follow other related articles on the PHP Chinese website!