Install Python

By | December 3, 2019

1. Requirements

This Python installation required GCC compiler on your system.  Use following command

yum install gcc openssl-devel bzip2-devel sqlite-devel

2. Download Python 3*

Download Python using the following command. In this example we use python 3.6.0

cd /usr/src
wget https://www.python.org/ftp/python/3.6.9/Python-3.6.0.tgz

Next extract the downloaded package using below command.

tar xzf Python-3.6.0.tgz

3. Install Python 3.6

Below set of commands are used to compile Python source code on your system using altinstall.

cd Python-3.6.0
./configure --enable-optimizations
make altinstall

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

Now remove downloaded source archive file from your system

rm /usr/src/Python-3.6.0.tgz

4. Check Python Version

python3.6 -V

Python 3.6.0