Python is a general-purpose programming language which can be used for a wide variety of applications. A great language for beginners because of its readability and other structural elements designed to make it easy to understand, Python is not limited to basic usage. In fact, it powers some of the world’s most complex applications and website.
The default Python version 2.7 is still same on latest CentOS 7. It is also not available in base repositories.
In this article I will show how to install python 3.5 on CentOS/RHEL 6/7.
Install Python 3.5
Follow the below steps to install python 3.5 on CentOS/RHEL 6/7.
1. Install Required Packages
First of all install all required packages. Run the below command to install packages.
# yum install gcc
2. Download Python 3.5
After installing required packages now download the the python using below command.
# cd /opt # wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
3. Extract Archive File and Compile
Use below commands to extract Python source code and compile it on your system using altinstall.
# tar xzf Python-3.5.1.tgz # cd Python-3.5.1 # ./configure # make altinstall
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.
4. Check Python Version
Now check the latest installed python version using below command.
# python3.5 -V Or # python3.5 --version
You will get some output like below.