How to Install Python on Amazon Linux Server - ASM , Rockville , Maryland

How to Install Python on Amazon Linux Server

In technical terms, Python is an object-oriented, high-level programming language with integrated dynamic semantics primarily for web and app development. It is extremely attractive in the field of Rapid Application Development because it offers dynamic typing and dynamic binding options. Python is relatively simple, so it’s easy to learn since it requires a unique syntax that focuses on readability.

At the writing time of this article Python 3.7.4 (in Python 3.7 series) latest stable version is available to download and install. This tutorial will help you to install Python 3.7.4 on Amazon Linux systems.

Step 1 - Install the GCC Compiler

Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.

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

Step 2 - Download Python

Download Python using the following command from the Python official site. You can also download the latest version in place of specified below.

$ cd /opt
$ sudo wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz

Now extract the downloaded package.

$ sudo tar xzf Python-3.7.4.tgz

Step 3 - Install Python

Use below set of commands to compile Python source code on your system using alt-install.

$ cd Python-3.7.4
$ sudo ./configure –enable-optimizations
$ sudo make altinstall

make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Now remove downloaded source archive file from your system

$ sudo rm /usr/src/Python-3.7.4.tgz

Step 4 - Check Python Version

Check if python installed correctly by checking its version. Use command python3.7 instead of python. The new binary will be installed at /usr/local/bin/python3.7 location:

$ python3.7 -V