• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Python 3.9 on Debian 10

Written by Admin, Updated On December 20, 2020
debian, python
How to Install Python 3.9 on Debian 10

Python is most popular programming language. It is used by multiple ways to build different kinds of applications. Python 3.9 is the latest major release of the Python language. It includes many new features such as new dict operators, new str functions, support for IANA time zone, and more. This tutorial describes multiple ways to install Python 3.9 on Debian 10 system.

Install Python 3.9 on Debian with Apt#

It’s very simple and straightforward process to install Python 3.9 on Debian using the apt packages manager.

Step 1 – 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#

After that add the deadsnakes PPA to your system’s sources list by typing:

sudo add-apt-repository ppa:deadsnakes/ppa

Hit the Enter when you get prompt.

Step 3 – Install Python 3.9#

Once the repository enabled you can install the Python 3.9 by runnig below command:

sudo apt update
sudo apt install python3.9

Step 4 – Verify Installation#

To verify the installation, you would type:

python3.9 --version
Python 3.9.0+

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

Install Python 3.9 on Debian from Source#

You can install the latest version of Python and customize the build options by compiling the Python from source. Below are the steps to install Python 3.9 from Python source:

Step 1 – Install dependencies#

You should install the required dependencies to build python. Run the following commands:

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev

Step 2 – Download source code#

After that download the latest source code from Python download page using wget:

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

Once the download is finished, extract the tarball:

tar -xf Python-3.9.0.tgz

Step 3 – Configure script#

Navigate to the Python source directory and execute the configure script. It will do few checks that required dependencies are installed.

cd Python-3.9.0
./configure --enable-optimizations

The --enable-optimizations option optimizes the Python binary by running multiple tests. This makes the build process slower.

Step 4 – Start build process#

You would run the following command to start the build process for python:

make -j 12

For faster build time, modify the -j to correspond to the number of cores in your processor. You can find the number by typing nproc.

Step 5 – Install Python#

Once the build process is complete, install the Python binaries by typing:

sudo make altinstall

That’s it. Python 3.9 has been installed from source and ready to be used. Verify the installation by typing:

python3.9 --version
Python 3.9.0+

Conclusion#

This tutorial shows you multiple ways to install Python 3.9 on Debian 10 system. You can read here How to use Pip.

If you have any questions or feedback, leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Notepad++ on Debian 10
Next Article   How to Install Notepad++ on CentOS 8

Related Posts

  • How to Change Hostname Debian 11

    How to Change Hostname on Debian 11

    February 3, 2023
  • How to Install Python 3.11 on Debian 11

    How to Install Python on Debian 11

    January 25, 2023
  • How to Install Mongodb on Debian 11

    How to Install MongoDB on Debian 11 Linux

    January 11, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook