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 CentOS/RHEL 8

    How to Install Python 3.8 on CentOS/RHEL 8

    By RahulSeptember 1, 20212 Mins Read

    Python is a powerful, friendly, and easy to learn programming language. At the writing time of this article Python 3.8 latest stable version is available to download and install.

    Advertisement

    This article will help you to install Python 3.8 from the source on your CentOS 8 and RHEL 8 Linux systems.

    Prerequisites

    First of all, log in to your CentOS 8 system with a root or sudo privileged account.

    Then use the following command to install the required development libraries for Python before installing it.

    sudo dnf install gcc openssl-devel bzip2-devel libffi-devel
    

    Downloading Python 3.8

    You can download Python using the following command from its official site. We also recommend to visit python ftp directory to check for latest version. To download Python 3.8.5, use the following commands.

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

    Then, extract the downloaded archive on your system.

    tar xzf Python-3.8.12.tgz
    

    Install Python on CentOS 8

    Switch to the extracted directory. Then configure the source files based on your system environment. After that use the following 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 and create separate binary file.

    Now remove downloaded source archive file from your system

    sudo rm Python-3.8.12.tgz
    

    Test Python

    Using the above installation, Python creates a separate binary file on your system. To use Python 3.8, you need to use a specific binary file. To test Python 3.8, execute:

    python3.8 -V
    
    Python 3.8.12
    

    Conclusion

    In this tutorial, you have learned to install Python 3.8 on CentOS 8 from source code.

    CentOS 8 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 1 Comment

    1 Comment

    1. RAC on September 29, 2020 9:29 pm

      Or:

      # dnf module -y install python38

      to install it from AppStream and not have to compile anything.

      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.