Home » repository » How to Install Python 3 on CentOS 7 Linux

How to Install Python 3 on CentOS 7 Linux

Update on:
Nov 10, 2019

Python is one of the most popular and easy to code programming language nowadays, because of its simplicity and easy to code. It is now very popular among beginners and experienced computer programmers or developers.

It is use to develop any kinds of software/applications using simple and few lines of code for complex machine learning algorithms also.

The major release version of Python is 3.8 these days. It has included many features like Positional-only parameters, f-strings support, Parallel filesystem cache and many more.

The Python 3.8 version is not included in default CentOS 7 repository. So, In this tutorial, we will show you the different ways to install Python on CentOS 7 Linux system.

In the first process, we will use the deb package from deadsnakes  PPA, and in the second process, we will install Python using source.

Install Python 3 on CentOS 7 with the yum package manager

To install Python 3 with apt is very simple, and it will install in very few steps only.

Step 1 – First update the package list on CentOS and install prerequisites to install Python on CentOS using the following commands:

$ sudo yum update

Step 2 – After updating the package you can install latest Python3 using below command:

$ sudo yum install python3

Step 3 – After installing the Python, we can verify it by checking the version of installed Python:

$ python3 --version
output:
Python 3.8.0

If your screen also showing output like above, means Python 3.8 is installed successfully on your CentOS system.

Installing Python 3.8 on CentOS 7 from source

In this method, we will explain the process to install Python 3.8 on CentOS 7 Linux using source.

Step 1 – In the first step, update the repository package list and install dependencies to build Python on CentOS, using the following command:

$ sudo yum update
$ sudo yum install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev

Step 2 – Now download Python 3.8 source code from the Python download page by using wget command, as shown below:

$ wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz

Step 3 – after download source package extracts the gzipped file using the following command:

$ tar -xf Python-3.8.0.tgz

Step 4 – Now enter into the new extracted Python source directory and run the configure script to check the system compatibilities, and dependencies to build Python on your system.

$ cd Python-3.8.0
$ ./configure --enable-optimizations

Using --enable-optimizations option to optimize Python binary by running multiple tests, this process may take a longer time.

Step 5 – Now, we can start Python 3.8 build process using make command as shown below:

$ make -j 8

Step 6 – After completing the build process, you can install Python binaries by using the following command:

$ sudo make altinstall

Step 7 – Now, Python 3.8 is installed in your system; you can verify it by checking the version of Python using the following command:

$ python3 --version

The output will show in your screen similar like below:

output:
Python 3.8.0

Conclusion

You have learned to install Python in your CentOS 7 system using two different methods, one is using deadsnakes repository, and another one is using source. Now, your system is ready to develop various python projects.

If you have any questions or doubt on this article, please comment below.

Related Posts

How to Install MongoDB on CentOS 8 Linux

How to Install MongoDB on CentOS 8 Linux

MongoDB is an open-source and free NoSQL document based database system. Nowadays, it is prevalent as most application developers are using MongoDB, which can handle big data. As a MongoDB is a NoSQL database, It stores data in JSON-like documents where fields can...

How to Install OpenCV on CentOS 8 Linux

How to Install OpenCV on CentOS 8 Linux

OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in commercial...

How to install and use FFmpeg on CentOS 8 Linux Operating System

How to install and use FFmpeg on CentOS 8 Linux Operating System

The FFmpeg is the most potent and useful command-line tool on Linux system for multimedia files transcoding. You can use FFmpeg to convert multimedia files between various video and audio formats and resize videos. It has multiple audio and video libraries such as...

How to Install VirtualBox on CentOS 8 Linux

How to Install VirtualBox on CentOS 8 Linux

VirtualBox is an Open Source tool, known as a cross-platform virtualization application or software. It used to run multiple operating systems or virtual machines simultaneously on a single hardware. In this VirtualBox installation tutorial, we will explain the...

Follow Us

Our Communities

More on CentOS

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

15 + fifteen =

Shares