Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

How to Install Python 3.9 on Debian 10

by | May 12, 2021

Wondering how to install Python 3.9 on Debian 10? We can help you.

As part of our Server Management Services, we assist our customers with several installation queries.

Today, let us see how our Support Techs install Python.

How to Install Python 3.9 on Debian 10

Python is a programming and scripting language developed under open source license, making it freely usable and distributable, even for commercial use.

Firstly, in Python development journey is the software installation. By default, Debian 10 comes with Python version 3.7. In this article, let us see how Linux users can install Python 3.9 on Debian 10 system.

Compiling Python from the source allows to install the latest Python version and customize the build options.

  • Firstly, update APT cache index before installing Python 3.9 on Debian 10 system.
$ sudo apt update

If upgrade is possible, then run the commands below.

$ sudo apt upgrade -y
  • Then, restart the system after a successful upgrade.
$ sudo reboot
  • After the system is rebooted, install dependency packages:
$ sudo apt install wget software-properties-common build-essential libnss3-dev zlib1g-dev libgdbm-dev libncurses5-dev libssl-dev libffi-dev libreadline-dev libsqlite3-dev libbz2-dev

 

Hit the y key to begin installation:

0 upgraded, 95 newly installed, 0 to remove and 0 not upgraded.
Need to get 74.7 MB of archives.
After this operation, 296 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Then, visit Python Downloads page and pull the latest release.

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

Extract the downloaded file.

$$ tar xvf Python-3.9.2.tgz

Change working directory to create Python folder:

$ cd Python-3.9.2/

Run configuration command:

$ ./configure –enable-optimizations

Sample output:

….
checking for shm_open… yes
checking for shm_unlink… yes
checking for pkg-config… no
checking for openssl/ssl.h in /usr/local/ssl… no
checking for openssl/ssl.h in /usr/lib/ssl… no
checking for openssl/ssl.h in /usr/ssl… no
checking for openssl/ssl.h in /usr/pkg… no
checking for openssl/ssl.h in /usr/local… no
checking for openssl/ssl.h in /usr… no
checking whether compiling and linking against OpenSSL works… no
checking for –with-ssl-default-suites… python
checking for –with-builtin-hashlib-hashes… md5,sha1,sha256,sha512,sha3,blake2
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Misc/python.pc
config.status: creating Misc/python-embed.pc
config.status: creating Misc/python-config.sh
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
config.status: pyconfig.h is unchanged
creating Modules/Setup.local
creating Makefile

 

Build Python 3.9 on Debian 10 Linux:

$ sudo make altinstall

Usually, a successful installation will have output similar to below:

….
changing mode of /usr/local/lib/python3.9/lib-dynload/__pycache__ to 755
running install_scripts
copying build/scripts-3.9/idle3.9 -> /usr/local/bin
copying build/scripts-3.9/pydoc3.9 -> /usr/local/bin
copying build/scripts-3.9/2to3-3.9 -> /usr/local/bin
changing mode of /usr/local/bin/idle3.9 to 755
changing mode of /usr/local/bin/pydoc3.9 to 755
changing mode of /usr/local/bin/2to3-3.9 to 755
rm /usr/local/lib/python3.9/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py
rm -r /usr/local/lib/python3.9/lib-dynload/__pycache__
/usr/bin/install -c -m 644 ./Misc/python.man \
/usr/local/share/man/man1/python3.9.1
if test “xupgrade” != “xno” ; then \
case upgrade in \
upgrade) ensurepip=”–altinstall –upgrade” ;; \
install|*) ensurepip=”–altinstall” ;; \
esac; \
./python -E -m ensurepip \
$ensurepip –root=/ ; \
fi
Looking in links: /tmp/tmpog4qrruc
Requirement already up-to-date: setuptools in /usr/local/lib/python3.9/site-packages (49.2.1)
Requirement already up-to-date: pip in /usr/local/lib/python3.9/site-packages (20.2.3)

Then, running the commands below will output the version of Python 3.9 available in our system:

$ python3.9 –version
Python 3.9.2

Finally, to install Python modules available in modules releases page, use the command syntax:

$ python3.9 -m pip install <module>

 

Install Python 3.9 on Debian 10 with Apt

First and foremost, it is very simple and straightforward process to install Python 3.9 on Debian using the apt packages manager.

Step 1: Firstly, update packages list

First, update the packages list and install required dependencies:

$ sudo apt update
$ sudo apt install software-properties-common

Step 2: Enable Repository

Then, add the deadsnakes PPA to system’s sources list by typing:

$ sudo add-apt-repository ppa:deadsnakes/ppa

Hit the Enter when we get prompt.

Step 3: Install Python 3.9

Once the repository is enabled, we can install the Python 3.9 by running the below command:

$ sudo apt update
$ sudo apt install python3.9

Step 4: Finally, verify Installation

To verify the installation, execute the command:

$ python3.9 –version
Python 3.9.0+

At this stage, the Python 3.9 is installed on Debian 10 system.

Upgrade from Python 3.7 to 3.9 in Debian 10

In order to, upgrade the version of Python from 3.7 to 3.9, we need to add Debian’s testing repositories.

Open the /etc/apt/sources.list file with the following command:

$ sudo nano /etc/apt/sources.list

Add the official testing repository. Append the following line of text to the end of the file:

$ deb http://http.us.debian.org/debian/ testing non-free contrib main

Our file should match this:

File: /etc/apt/sources.list
deb http://mirrors.linode.com/debian buster main
deb-src http://mirrors.linode.com/debian buster main

deb http://mirrors.linode.com/debian-security buster/updates main
deb-src http://mirrors.linode.com/debian-security buster/updates main

# buster-updates, previously known as ‘volatile’
deb http://mirrors.linode.com/debian buster-updates main
deb-src http://mirrors.linode.com/debian buster-updates main

# Debian Testing Non-Free

deb http://http.us.debian.org/debian/ testing non-free contrib main

After editing the file, download the information for all of the packages available with the following command:

$ sudo apt update

Upgrade Python 3 with the following command:

$ sudo apt upgrade python3

Because Python3 requires a lot of dependencies, we are prompted to allow Debian to restart certain services. If we are not running any active processes, this is okay. Otherwise, we may decide to restart the services ourselves.

Verify that we have updated Python by checking the version:

$ python3 –version

Python 3.9.1

Now Debian 10 system has the latest version of Python 3 installed.

[Need any further assistance to fix CyberPanel errors? – We’re available 24*7]

Conclusion

In short, Python is a programming and scripting language developed under open source license, making it freely usable and distributable, even for commercial use. Today, we saw how our Support techs assist with Python installation.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF