Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»Python»How To Install Python 3.9 on Debian 10

    How To Install Python 3.9 on Debian 10

    RahulBy RahulDecember 20, 20202 Mins ReadUpdated:July 17, 2021

    Python is an object-oriented, high-level programming language. It is open-source with a large community. Python is used as a key language 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.

    Debian 10 default repositories come with Python 3.7. So if your application can work with this version, install it from default repositories using command apt install python3 . To install Python 3.9 on Debian 10 follow this tutorial.

    This tutorial will describe you install Python 3.9 on Debian 10 Linux system.

    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  
    

    Install Python 3.9 on Debian

    The default Debian repositories contain Python 3.7 only. So this tutorial will use Python source code for installation on Debian 10 system.

    Follow the below steps to install Python 3.9 on Debian:

    1. Download Python – You can directory download Python 3.9 source archive from its official site.
      wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz 
      
    2. Extract Archive – After downloading, extract the archive file on your system.
      tar xzf Python-3.9.6.tgz 
      
    3. Compiling Python Source – Change to the extracted directory with cd command, then prepare the Python source code for the compilation on your system.
      cd Python-3.9.6 
      ./configure --enable-optimizations 
      
    4. Install Python 3.9 – 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 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.6
    

    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 Debian Linux systems using source code. You can try Python examples via command line.

    debian Debian 10 Python Python3 Python3.9
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install PyCharm on Debian 10
    Next Article Linux Run Commands As Another User

    Related Posts

    How to accept user input in Python

    2 Mins Read

    Setup Selenium with Python and Chrome on Ubuntu & Debian

    Updated:June 20, 20224 Mins Read

    Setup Selenium with Python and Chrome on Fedora

    Updated:June 18, 20223 Mins Read

    How to Setup Squid Proxy Server on Ubuntu and Debian

    Updated:June 17, 20225 Mins Read

    Creating Python Virtual Environment on Windows

    Updated:June 3, 20222 Mins Read

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    3 Comments

    1. Fran on May 4, 2021 6:02 am

      Set default:

      update-alternatives –install /usr/bin/python python /usr/local/bin/python3.9 1

      update-alternatives –install /usr/bin/pip pip /usr/local/bin/pip3.9 1

      Reply
    2. Benbb96 on January 21, 2021 5:03 pm

      Thanks, this really helped me !

      Just wanted to add that I had to use sudo for the command `make altinstall` in order to install it correctly.

      Reply
    3. carkukilme on January 5, 2021 10:25 pm

      Хорош.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How To Install Docker on Ubuntu 22.04
    • How to Install Bower on Ubuntu 22.04 & 20.04
    • How to run “npm start” through Docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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