Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»Python»How To Install Python 3.9 on Ubuntu, Debian & LinuxMint

    How To Install Python 3.9 on Ubuntu, Debian & LinuxMint

    By RahulSeptember 1, 20212 Mins Read

    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.

    Advertisement

    As of today, Python 3.9 is the latest stable version available for productions environments. Most of the Debian-based Linux distribution includes older versions 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 it 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 the 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.7/Python-3.9.7.tgz 
      
    2. Once the download is completed, extract the archive file on your system.
      tar xzf Python-3.9.7.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.7 
      ./configure --enable-optimizations 
      
    4. Finally, run the following command to complete the Python installation on the Debian system. The altinstall prevents the compiler to override default Python versions.
      make altinstall 
      

    Wait for the Python installation to 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.7
    

    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.

    Python Python3 Python3.9
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Create and Read List in Python

    What are the Python Static Variables

    Python Program to Add Two Numbers

    View 5 Comments

    5 Comments

    1. Parfait detchenou on May 9, 2021 7:13 pm

      How to uninstall that now ? Please.

      Reply
    2. Tom on May 2, 2021 10:46 am

      for cannot create regular file ‘/usr/local/bin/python3.9’: Permission denied
      sudo make altinstall

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

      Reply
    3. bronek on April 15, 2021 10:37 pm

      I have that

      cannot create regular file ‘/usr/local/bin/python3.9’: Permission denied

      help, please

      Reply
      • Herik on April 19, 2021 7:53 pm

        The same thing happened to me, please help!

        Reply
    4. Roderic on March 8, 2021 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?

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.