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.
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
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