• Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How To Install Python 3.9 on Ubuntu, Debian & LinuxMint

Written by Rahul, Updated on April 7, 2021

Python is an object-oriented, high-level programming language. The Python 3.9 stable version has been released with several improvements and security updates. Which included multiple new modules and improved existing modules and new features.

As of today, Python 3.9 is the latest stable version available for production used. Most of the Debian based Linux distribution’s includes older version of Python in software repositories. Also the Debian packages are not available for all distributions. In this tutorial you will learn to compile Python 3.9 from source code and install on Debian based systems.

This tutorial will help you to how to install Python 3.9 on Ubuntu, Debian, and LinuxMint systems using source code.

Prerequisites

Login to the Debian system with sudo privileged account access. Open a terminal (CTRL+ALT+T) and execute below commands to update packages.

sudo apt update && sudo apt upgrade 

Then install the required packages for the compilation of Python source code.

sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev \
     libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev  

Installing Python 3.9 with Source

Download the latest Python version source code from the official websites. Then compile the source code for your system and install it.

Follow the below steps to install Python 3.9 on Debian systems:

  1. You can directory download Python 3.9 source archive from its official site or use below command.
    wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz 
    
  2. Once download is completed, extract the archive file on your system.
    tar xzf Python-3.9.4.tgz 
    
  3. Change to the extracted directory with cd command, then prepare the Python source code for the compilation on your system.
    cd Python-3.9.4 
    ./configure --enable-optimizations 
    
  4. Finally, run the following command to complete the Python installation on Debian system. The altinstall prevents the compiler to override default Python versions.
    make altinstall 
    

Wait for the Python installation complete on your system.

Check Python Version

At this step, you have successfully installed Python 3.9 on Debian 10 system. You need to type python3.9 to use this version. For example, to check the Python version, execute:

python3.9 -V 

Python 3.9.4

This will also install pip for Python 3.9.

pip3.9 -V 

pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

That’s it, You have successfully installed Python 3.9 on Debian 10 system.

Conclusion

In this tutorial, you have learned to install Python 3.9 on Ubuntu, Debian, and LinuxMint systems using source code. You can try Python examples via command line.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

1 Comment

  1. Avatar Roderic Reply
    March 8, 2021 at 12:36 pm

    Hi Rahul, unfortunately step 3 results in errors:

    ./configure –enable-optimizations
    ./configure: line 2380: config.log: Permission denied
    ./configure: line 2390: config.log: Permission denied

    How to resolve?

Leave a Reply Cancel reply

Popular Posts

  • How to View or List Cron Jobs in Linux
  • How to Install PHP 8 on Ubuntu 20.04
  • How to Set Up SSH Tunnel with PuTTY
  • How to Install Tor Browser on Ubuntu 20.04
  • Issue with phpMyAdmin and PHP: Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”
  • How to Allow Remote Connections to MySQL
  • How to Install MySQL 8.0 on Ubuntu 20.04
  • How to Install Apache Kafka on Ubuntu 20.04
© 2013-2021 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy