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.
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.
In my case, I will install the latest build, which is 3.8.1 and will run the command below which will download it.
I will go ahead and unzip the file.
sudo tar xzf Python-3.8.1.tgz
Next, open the directory
The two commands below will install the files.
sudo ./configure --enable-optimizations
sudo make altinstall
To run Python 3.8, type