How to Install Python 3.5.5 on CentOS/RHEL and Fedora

Python is a powerful programming language. It is very friendly and easy to learn. At the writing time of this article Python 3.5.5 is the latest stable version available to install. This tutorial will help you to install Python 3.5.5 on your CentOS, Red Hat & Fedora operating systems.

Step 1 – Prerequsites

Use the following command to install prerequisites for Python before installing it.
yum install gcc

Step 2 – Download Python 3.5

Download Python using following command from python official site. You can also download latest version in place of specified below.
cd /usr/src
wget https://www.python.org/ftp/python/3.5.5/Python-3.5.5.tgz
Now extract the downloaded package.
# tar xzf Python-3.5.5.tgz

Compile Python Source

Use below set of commands to compile python source code on your system using altinstall.
cd Python-3.5.5
./configure --enable-optimizations

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
rm Python-3.5.5.tgz

Check Python Version

Check the latest version installed of python using below command
python3.5 -V

Python 3.5.5