How To Install python on CentOS 7

In this tutorial we learn how to install python on CentOS 7. python is An interpreted, interactive, object-oriented programming language

Introduction

In this tutorial we learn how to install python on CentOS 7.

What is python

Python is an interpreted, interactive, object-oriented programming language often compared to Tcl, Perl, Scheme or Java. Python includes modules, classes, exceptions, very high level dynamic data types and dynamic typing. Python supports interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac and MFC). Programmers can write new built-in modules for Python in C or C++. Python can be used as an extension language for applications that need a programmable interface. Note that documentation for Python is provided in the python-docs package. This package provides the “python” executable; most of the actual implementation is within the “python-libs” package.

We can use yum or dnf to install python on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install python.

Install python on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install python using yum by running the following command:

sudo yum -y install python

Install python on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install python using dnf by running the following command:

sudo dnf -y install python

How To Uninstall python on CentOS 7

To uninstall only the python package we can use the following command:

sudo dnf remove python

References

Summary

In this tutorial we learn how to install python on CentOS 7 using yum and dnf.