How to install Python 3.9.5 on a Linux system

Image [1]-How to install Python 3.9.5 on Linux system - Photon Flux | Professional WordPress repair service, worldwide, fast response

Step 1: Update the list of system packages

Before installing any software, it is recommended to update the system package list to ensure that the latest packages are used. Run the following command in a terminal:

sqlCopy codesudo apt-get update

Step 2: Install the dependencies needed to build Python

Before installing Python, you need to install some of the dependencies required to build Python. Run the following command in the terminal:

arduinoCopy codesudo apt-get install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget

Step 3: Download Python 3.9.5 source code

Download the source code for Python 3.9.5 from the official Python web site and you can use the wget command to download:

rubyCopy codewget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz

Step 4: Unzip the downloaded source code file

Once the download is complete, you need to extract the downloaded source code file. Run the following command in the terminal:

Copy codetar -xf Python-3.9.5.tgz

Step 5: Go to the unzipped directory

After unpacking, go to the unpacked directory. Run the following command in the terminal:

bashCopy codecd Python-3.9.5

Step 6: Configure Python's build options

After entering the Python source directory, you need to configure the Python build options. Run the following command in the terminal:

bashCopy code. /configure --enable-optimizations

This command will enable optimization options to speed up Python.

Step 7: Use the make command to build Python

After the configuration is complete, use the make command to build Python. run the following command in a terminal:

bashCopy codemake -j$(nproc)

Here the -j$(nproc) parameter to utilize all of the system's CPU cores for parallel builds and faster builds.

Step 8: Install Python to the system

After the build is complete, you can use the make command to install Python on your system. Run the following command in the terminal:

goCopy codesudo make altinstall

Note: here the altinstall rather than install command. This is because if you have other versions of Python installed at the same time, the altinstall command will leave the system's default Python version in place and install Python 3.9.5 as another available version.

Step 9: Verify Python Installation

After completing the installation, you can verify that the Python installation was successful. Run the following command in the terminal:

cssCopy codepython3.9 --version

If the installation was successful, you should see the Python 3.9.5 version number

To see if Python is installed on your Linux system, you can run the following command in a terminal window:

cssCopy codepython --version

If Python is already installed on your system, the installed Python version number is displayed.

If this command fails to output a version number, then Python is not installed on your system and you need to install it first. The specific installation method varies by distribution, so you can refer to your distribution's documentation or use a Web search engine to find out how to install it.


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
Customer Service
Customer Service
Tel: 020-2206-9892
QQ咨詢(xún):1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
? Reprint statement
This article was written by Harry
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments