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 CentOS/RHEL 7 & Fedora 34/33

    How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 34/33

    RahulBy RahulNovember 2, 20202 Mins ReadUpdated:July 17, 2021

    Recently, the Python development team released the latest stable version of Python 3.9. You can download it from its official pages. The new version comes with multiple new features and security updates.

    This tutorial will help you to install Python 3.9 on CentOS/RHEL 7 & Fedora systems. We will compile Python from the source code.

    Prerequisites

    This Python installation required the GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.

    sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel 
    

    Step 1 – Download Python 3.9

    Download Python using following command from python official site. You can also download the latest version in place of the specified below.

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

    Then, extract the archive file on your system:

    tar xzf Python-3.9.6.tgz 
    

    This will create a directory named Python-3.9.6 in the current directory.

    Step 2 – Install Python 3.9 on CentOS

    Change directory to Python-3.9.4 and use the following commands to compile Python source code on your system using altinstall.

    cd Python-3.9.6 
    sudo ./configure --enable-optimizations 
    sudo make altinstall 
    
    make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

    Now remove downloaded source archive file from your system

    sudo rm Python-3.9.6.tgz 
    

    Step 3 – Test Python Version

    Check the latest version installed of python using the below command

    python3.9 -V  
    
    Python 3.9.6
    

    Conclusion

    In this tutorial, you have learned to install Python 3.9 on CentOS 7 and Fedora systems using source code.

    centos fedora Python Python3 Python3.9
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install NVM on Amazon Linux
    Next Article How to Install Visual Studio Code on Ubuntu 18.04

    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

    Creating Python Virtual Environment on Windows

    Updated:June 3, 20222 Mins Read

    How To Install Apache Solr 9.0 on Fedora 36/35

    Updated:May 26, 20223 Mins Read

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    3 Comments

    1. Roger Thompson on July 1, 2021 7:29 pm

      How do I do this in an alternate location without having sudo privilege? My location to install is /opt/python/Python-3.9.5

      Reply
    2. Reggie on May 12, 2021 5:48 am

      Hi, how do I remove it please ?

      Reply
    3. Sjoerd on April 20, 2021 5:19 pm

      Hi Rahul,

      Pretty straightforward. Worked like charm. Seems to be a better approach then adding epel or remi repo’s.
      If there is a new version, how should we deal with the old version – If for example 3.9.8 got release how do we get rid of this version?
      And.. how can I default to 3.9.4 (2.7.5 comes with a clean install)
      Regards

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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