• 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 20.04

Written by Rahul, Updated on October 26, 2020

Python is an object-oriented, high-level programming language. It is an open source with a large community. Python is used as key languages among the top tech companies like Google.

The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules and many other features.

You can choose deadsnakes PPA for Python installation on Ubuntu 20.04 system.

Use this tutorial to install Python 3.9 On Ubuntu 20.04 LTS Linux system via Apt-Get. You can also choose second method to install Python using source code.

Prerequisites

Login to your Ubuntu system and open a terminal, then install some required packages.

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

Installing Python 3.9 Using Apt

Use the Ubuntu package manager Apt to install Python 3.9 on Ubuntu Linux system. Follow the below steps:

  1. Open a terminal by pressing CTRL+ALT+T and then configure deadsnakes PPA to your system.
    sudo add-apt-repository ppa:deadsnakes/ppa 
    
  2. Once your added the ppa on your Ubuntu system, update the apt cache and install Python 3.9 on Ubuntu.
    sudo apt update 
    sudo apt install python3.9 
    
  3. Wait for the installation to complete. Check the Python version by executing:
    python3.9 -V 
    
    Python 3.9.0
    

That’s it, You have successfully installed Python 3.9 on your Ubuntu 20.04 LTS system.

Installing Python 3.9 Using Source Code

You also have one more option option to install Python 3.9 using source code. We don’t recommend to install Python 3.9 packages from source code. But in some cases you may need to install Python from source code.

So follow the below instructions to install Python 3.9 using source code on Ubuntu 20.04 Linux system.

  1. First of all, install essential packages for compiling source code. Open a terminal and execute following commands:
    sudo apt install build-essential checkinstall 
    sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
        libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev 
    
  2. Now, download the Python 3.9 source code from official download site. Switch to a relevant directory and use wget to download source file.
    cd /opt 
    sudo wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tgz 
    
  3. Next, extract the downloaded archive file and prepare the source for the installation.
    tar xzf Python-3.9.0.tgz 
    cd Python-3.9.0 
    sudo ./configure --enable-optimizations 
    
  4. Python source is ready to install. Execute make altinstall command to install Python 3.9 on your system.
    sudo make altinstall 
    

    make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

  5. The Python 3.9 has been installed on Ubuntu 18.04 system. Verify the installed version:
    python3.9 -V 
    
    Python 3.9.0
    
  6. Remove the downloaded archive to free space
    sudo rm -f /opt/Python-3.9.0.tgz 
    

Conclusion

In this tutorial, you have learned to install Python 3.9 on Ubuntu 20.04 using Apt and 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..

5 Comments

  1. Avatar MAZARIEGOS448 Reply
    January 1, 2021 at 4:34 pm

    Thank you!!1

  2. Avatar Jaime Reply
    December 20, 2020 at 6:07 pm

    Thank you! This was quick and painless!

  3. Avatar Hamza Reply
    December 3, 2020 at 3:34 pm

    Thank you! The method worked with me successfully and installed Python 3.9

  4. Avatar Tim Reply
    November 17, 2020 at 8:12 am

    Thank you so much!!!!!!!!!!!!!!

  5. Avatar Minas Reply
    November 1, 2020 at 2:39 pm

    Thank you very much!

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Debian 10
  • Download Ubuntu 20.04 LTS – DVD ISO Images
  • Linux Run Commands As Another User
  • How to Check PHP Version (Apache/Nginx/CLI)
  • How To Install and Configure GitLab on Ubuntu 20.04
  • How to Install PyCharm on Ubuntu 20.04
  • How to Check Ubuntu Version with Command or Script
  • How to Set all directories to 755 And all files to 644
© 2013-2021 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy