Install Python 3.8 on Amazon Linux 2 EC2 Instance

In this blog post, I will show you how to install the latest Python version on an Amazon Linux 2 EC2 instance.

In my case, I have an Amazon Linux 2 EC2 instance that I have deployed, and by default, it comes with Python 2.7.

Installation Steps

To start the process, I will SSH to my instance and run the following command that will install all the dependencies.

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

Next, Check the Python website below for the latest build number.

https://www.python.org/downloads/source/

In my case, I will install the latest build, which is 3.8.1 and will run the command below which will download it.

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

I will go ahead and unzip the file.

sudo tar xzf Python-3.8.1.tgz

Next, open the directory

cd Python-3.8.1/

The two commands below will install the files.

sudo ./configure --enable-optimizations
sudo make altinstall

To run Python 3.8, type

python3.8

Processing…
Success! You're on the list.

Posted

in

,

by

Comments

One response to “Install Python 3.8 on Amazon Linux 2 EC2 Instance”

  1. Max Allan Avatar
    Max Allan

    Or : amazon-linux-extras enable python38 ; yum -y install python38