Python3.9 installation on Amazon Linux 2

This post explains how to install Python3.9 on Amazon Linux 2.

Python3.9 installation steps on Amazon Linux 2 :

①: Install the necessary build dependencies
     

sudo yum -y groupinstall "Development Tools"

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


②: Download the Python Gzipped source file
         

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


③: Unpack the .tgz file
        

tar zxvf Python-3.9.7.tgz

    
    

④: Navigate to Python-3.9.7 folder
        

cd Python-3.9.7/

    
    

⑤: Execute configure script
        

./configure

    
    

⑥: Build the Python3.9 binary
    

make


⑦: Install the Python3.9 binary
        

sudo make altinstall

    
    

⑧ : Verify Python3.9 installation
    

python3.9 --version

# Output
Python 3.9.7


⑨ : Create and activate new virtual environment
    

python3.9 -m venv test_venv

source test_venv/bin/activate


Categories: Python

Similar Articles