How to Install Python 3.9 on Debian 11

In this tutorial, we will show you how to install Python 3.9 on Debian 11. For those who don’t know, Python is a free and open source programming language for various software projects. This programming language has a clear syntax and good readability. Debian provides the latest stable Python 3 release. It also provides the latest stable Python 2 release, but Python 2 is not supported by the Python Foundation since January 1, 2020, and has been removed starting with Debian 11 (Bullseye).

This article assumes that you have at least a basic knowledge of Linux, know how to use the shell, and most importantly, that you host your site on your own VPS. Installation is very simple, assuming you are running in the root account, otherwise you may need to add the ‘ sudo ‘ command to gain root privileges. I will show you how to install the Python programming language step by step on Debian 11 (Bullseye).

Install Python 3.9 on Debian 11 Bullseye

Step 1. Before we install any software, make sure your system is up to date by running the following command in the apt terminal:

 apt update apt upgrade apt install wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

Step 2. Install Python 3.9 on Debian 11.

download

 wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz

Next, unzip the downloaded file while changing to the unzipped directory:

 tar xzf Python-3.9.7.tgz cd Python-3.9.7 

Finally, run the configure command and complete the Python installation:

 ./configure --enable-optimizations make altinstall 

Step 3. Check the version of Python installed.

Once installed, you can check what version is installed for Python 3 using the command given below:

 python3 --version

output:

 [email protected]:~# python3 --version Python 3.9.7

Congratulations! You have successfully installed Python.

If it prompts an error:

image.png

image.png

It is because there is no soft link to the bin directory, a soft link is enough

View the path of the python file

 whereis python python: /usr/local/bin/python3.9-config /usr/local/bin/python3.9 /usr/local/lib/python3.9

soft link

 ln -s /usr/local/bin/python3.9 /usr/bin/python 

That’s it!

Thank you for using this tutorial to install the latest version of Python 3.9 on Debian 11 Bullseye. For more help or useful information, we recommend checking out the official Python website .

This article is reprinted from: https://diannaobos.com/post/1100.html
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment