• Anuradha Agarwal

Steps to setup Python 3.8 on Linux

In this post, I will be taking you through end to end steps to set up Python 3.8 on Linux Machine.

This post is also a resource to my Udemy course Performance Testing using Locust.

For this purpose, I will use AWS EC2- Linux. By default Python 2.7 comes preinstalled on AWS EC2 Linux and also other Linux distributions. However, this may not be enough for the application requirements. At this point in time, Python 37 is available in yum repository and can be installed from Sudo yum install command. However, python38 is not available in the repository. In this case, we can easily compile the latest version of Python from the source(which is python 3.8.3 currently).

To visit more such posts, follow: #TestEnvironment #Locust


Step 1 - Avail Linux machine or AWS EC2 Linux instance

Step 2 - Install GCC Compiler

Step 3 - Download Python 3.8

Step 4 - Run Configure Script

Step 5 - Verify Python

Before we compile python3.8, we need to have GCC compiler. Install it with below command:

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

Source code for latest python can be downloaded from python official page -

Here we will download python 3.8.3 version in the /opt directory with below commands:

cd /opt/
sudo wget
sudo tar xzf Python-3.8.3.tgz
cd Python-3.8.3
  • Run Configure script with below switch:

----enable-optimizations  -to boost performance of python
sudo ./configure --enable-optimizations
  • Compile python source

sudo make altinstall
make sure to add altinstall inorder not to overwrite path for default shipped python -/usr/bin/python

If we would not have used altinstall, python 3.8 binary would have got installed in /usr/local/bin/ and python --version would have given 3.8.3. But as that's not the case, use below command to verify python 3.8:

python3.8 -V

You can remove the source code as its no longer required.

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

Never Miss a Post. Subscribe Now!