1. Prerequisites

Firstly make sure that you have GCC package installed on your system. Use the following command to install GCC if you don’t have it installed.

2. Download Python 2.7

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

3. Install Python 2.7

Now run the following commands to compile Python 2.7 and install on your system using altinstall. make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

4. Check Python Version

Check the latest version installed of python using below command. During this installation, the latest Python binary was installed on path /usr/local/bin/python2.7. The existing binary was located under /usr/bin. Warning: Do not overwrite or link the original Python binary, This may damage your system.

5. Install PIP

PIP is a useful utility to install and manage Python modules. Let’s install the PIP for the installed Python version.