Python is a powerful programming language. It is very friendly and easy to learn. At the writing time of this article Python 3.5.9 is the latest stable version available to install. This tutorial will help you to install Python 3.5.9 on your CentOS, Red Hat & Fedora operating systems.
Step 1 – Prerequisites
Use the following command to install prerequisites for Python before installing it.
yum install gcc sqlite-devel
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.9/Python-3.5.9.tgz
Now extract the downloaded package.
tar xzf Python-3.5.9.tgz
Compile Python Source
Use below set of commands to compile python source code on your system using altinstall.
cd Python-3.5.9 ./configure --enable-optimizations make altinstall
Now remove downloaded source archive file from your system
rm Python-3.5.9.tgz
Check Python Version
Check the latest version installed of python using below command
python3.5 -V Python 3.5.9
6 Comments
Thanks a lot
Hi Guys why its not installed pip3 .At the end of installation it prints that it install pip instead of pip3?
Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0
pip3 doesnt exist. Instead its baked into python3.
see: https://docs.python.org/3/installing/index.html
Thank you for this tutorial. In addition I had to
yum install openssl-devel
before installation and use extra flag to install pip properly
./configure –enable-optimizations –with-ensurepip=install
also used ‘make -j4’ instead of ‘make’ for speeding up on my 4 cores
You did a great job on this tutorial. Thanks!
Thanks!!