How to install Python 3.7 on Debian 9?

青灯夜游
Release: 2019-04-09 10:17:22
Original
7933 people have browsed it

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.

How to install Python 3.7 on Debian 9?

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
Copy after login

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
Copy after login

3. After the download is completed , use the tar command to decompress:

$ tar -xf Python-3.7.3.tar.xz
Copy after login

4. Navigate to the python source directory and run the configure script

The configureThe 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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

Output

Python 3.7.3
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template