How To Install python-matplotlib on CentOS 7

In this tutorial we learn how to install python-matplotlib on CentOS 7. python-matplotlib is Python 2D plotting library

Introduction

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

What is python-matplotlib

Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell, web application servers, and six graphical user interface toolkits. Matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code.

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

Install python-matplotlib 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-matplotlib using yum by running the following command:

sudo yum -y install python-matplotlib

Install python-matplotlib 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-matplotlib using dnf by running the following command:

sudo dnf -y install python-matplotlib

How To Uninstall python-matplotlib on CentOS 7

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

sudo dnf remove python-matplotlib

References

Summary

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