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

    How To Install Python 3.8 on RHEL/CentOS 7 & Fedora 34/33

    By RahulSeptember 1, 20211 Min Read

    Python is a powerful programming language. It is very friendly and easy to learn. At the writing time of this article Python 3.8 latest stable version is available to download and install. This article will help you to install Python 3.8.12 on your CentOS, Red Hat & Fedora operating systems.

    Advertisement

    Step 1 – Install Required Packages

    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 2 – Download Python 3.8

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

    cd /opt
    wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz
    

    Now extract the downloaded package.

    tar xzf Python-3.8.12.tgz
    

    Step 3 – Compile Python Source

    Use below set of commands to compile python source code on your system using altinstall.

    cd Python-3.8.12
    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.8.12.tgz
    

    Step 4 – Check Python Version

    Check the latest version installed of python using the following command.

    python3.8 -V
    
    Python 3.8.12
    

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

    Related Posts

    How to Validate Email Addresses in Python (Using Regular Expressions)

    How to Create and Read List in Python

    What are the Python Static Variables

    View 21 Comments

    21 Comments

    1. Duff on June 30, 2022 4:12 pm

      What if you can’t sudo? That is why I need a guide.

      Reply
    2. Sundar on August 31, 2021 8:05 pm

      In Step 1, I would also include zlib-devel. Not doing so throws error in “make altinstall” or “make install” step.

      Reply
      • Rahul on September 1, 2021 4:11 am

        Thanks Sundar, Article updated

        Reply
    3. FAKE-LINUS on March 16, 2021 3:22 pm

      Works great on Fedora 33, thanks 🙂

      Reply
    4. Phichayut Sakwiset on March 1, 2021 1:28 am

      How to cleanly remove it the same way?

      Reply
      • SOMEONE on March 15, 2021 10:00 am

        sudo make uninstall

        Reply
        • abkouo on March 16, 2021 1:59 pm

          uninstall is not a defined keyword from the Makefile

          Reply
    5. Abdulla on December 4, 2020 5:45 pm

      If you wanted to revert everything back after this installation, how would you do it?

      Reply
    6. Peter on November 13, 2020 12:59 am

      Lo instale con root y todo funciona perfectamente pero tengo un problema, un usuario especifico no puede utilizar pip3.8, me recomiendas realizar la instalación con ese usuario utilizando sudo?

      anexo el mensaje:

      $ pip3.8 -V
      Traceback (most recent call last):
      File “/usr/local/bin/pip3.8”, line 6, in
      from pip._internal.cli.main import main
      ModuleNotFoundError: No module named ‘pip._internal’

      Saludos y espero puedan ayudarme.

      Reply
    7. Jeff on May 23, 2020 3:35 am

      Followed your instructions, worked perfectly for Fedora 31. Thank you!

      Reply
    8. xzy5412 on May 6, 2020 8:51 pm

      Please add: In case make command is not working use: yum install make

      Reply
    9. Aditya on November 6, 2019 5:11 pm

      The version print typo still exists 🙂

      Reply
      • Rahul on November 7, 2019 7:21 am

        Thanks Aditya, we have corrected the Typo.

        Reply
        • Aditya on November 7, 2019 10:27 am

          Cheers

          Reply
    10. Archi on October 27, 2019 4:26 pm

      Please double check your tutorials 🙂

      wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz <—- 3.8 !!
      tar xzf Python-3.4.8.tgz <—- 3.4 ??

      python3.8 -V <—- 3.8 !!
      Python 3.4.8 <—- 3.4 ??

      Reply
      • Rahul on October 29, 2019 12:25 pm

        Thanks Archi, I have corrected the typo.

        Reply
    11. rild on October 25, 2019 2:01 pm

      you’ve used Python-3.4.8 by mistake in your text

      Reply
    12. Anshuman Chatterjee on September 30, 2017 7:12 pm

      Centos now supports Python-3.6.0 as well.

      Better to use this version instead of the old 3.4

      https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

      cd /usr/src

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

      tar xzf Python-3.6.0.tgz

      cd Python-3.6.0

      ###This enables some known optimizations in the higher versions os Python.
      ./configure –enable-optimizations

      make altinstall

      Reply
    13. lance on September 28, 2016 10:35 am

      It seems to take forever, 10+ minutes now , message lines “checking” if, for variables listed alphabetically, and takes loops (?)

      Reply
    14. Ramon on April 18, 2016 4:42 pm

      Thanks!

      Reply
    15. Mayank on December 26, 2015 7:48 pm

      Please add the following step as well.
      rm Python-3.4.3.tgz

      Good Article. Small and to the point.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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