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 Amazon Linux

    How to Install Python 3.8 on Amazon Linux

    By RahulSeptember 1, 20212 Mins Read

    Python is a powerful programming language. It is very friendly and easy to learn. During the latest update of this article Python 3.8.12 (of Python 3.8 series) latest stable version is available to download and install. This tutorial will help you to install Python 3.8 on Amazon Linux systems.

    Advertisement

    Step 1 – Prerequaities

    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
    
    • Read: How to Use SSH to Connect Remote Linux Server

    Step 2 – Download Python 3.8

    Download the Python from the Python official website. You can also download the latest version in place of the specified below.

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

    Now extract the downloaded package.

    sudo tar xzf Python-3.8.12.tgz
    

    Step 3 – Install Python 3.8

    Use the below set of commands to compile Python 3.8 from the source code and install using the altinstall command.

    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 the downloaded source archive file from your system

    sudo rm -f /opt/Python-3.8.12.tgz
    

    Step 4 – Check Python Version

    The Python 3.8 binary is installed under /usr/local/bin directory. As we have not overwritten the current Python version, you need to run Python 3.8 command as following:

    python3.8 -V
    
    Python 3.8.12
    

    Amazon Linux 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 10 Comments

    10 Comments

    1. Truth Talker on June 20, 2021 5:34 pm

      Why would one do all this instead of just following the AWS documentation?

      “amazon-linux-extras install python3.8” will install Python/Pip 3.8. To access them just use “python3.8” or “pip3.8” at the console.

      Reply
    2. Murat on June 8, 2021 7:47 pm

      Thank you, Rahul. A helpful article.

      Reply
    3. Tommy on February 9, 2021 1:28 pm

      sudo ./configure –enable-loadable-sqlite-extensions –enable-optimizations

      if you are interestest at least to use jupyter

      Reply
    4. Michael on November 20, 2020 9:11 am

      Thanks! Works great.
      Small typo:
      Fix step 2: It shows to un-tar 3.8.5 instead of 3.8.6

      Reply
      • Rahul on November 20, 2020 9:23 am

        Thanks Michael,

        Typo corrected

        Reply
    5. Dave on September 20, 2020 1:06 pm

      Installed on an AWS Linux 2 instance. If I try to run python3.8 from root prompt it does not find the command. If I exit root mode the command runs fine. Path issue?

      Reply
    6. Sudharsan on August 13, 2020 5:42 pm

      Great help and really strange that we don’t have AMI in amazon with latest python 3.8.2. I was struggling to package my dependent libraries in lambda and your detailed steps really benefitted me.

      Thanks,
      -Sudharsan.

      Reply
    7. John on August 1, 2020 3:52 am

      Great writeup and site!
      Your instructions are easy to follow.
      Thank you!

      Reply
    8. Mat on March 11, 2020 4:24 pm

      Hi Rahul,

      ty for this great instruction.

      I have two remarks:

      – Shouldn’t the first command (Step 1) be execuded with sudo?

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

      – We downloaded the .tgz file to /opt – so shouldn’t the remove command be:

      sudo rm /opt/Python-3.8.2.tgz

      Regards
      Mat

      Reply
      • Rahul on March 12, 2020 6:31 am

        Thanks Mat, I have updated tutorial.

        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.