How To Install python-gmpy2 on CentOS 7

In this tutorial we learn how to install python-gmpy2 on CentOS 7. python-gmpy2 is Python 2 interface to GMP, MPFR, and MPC

Introduction

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

What is python-gmpy2

This package contains a C-coded Python extension module that supports multiple-precision arithmetic. It is the successor to the original gmpy module. The gmpy module only supported the GMP multiple-precision library. Gmpy2 adds support for the MPFR (correctly rounded real floating-point arithmetic) and MPC (correctly rounded complex floating-point arithmetic) libraries. It also updates the API and naming conventions to be more consistent and support the additional functionality.

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

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

sudo yum -y install python-gmpy2

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

sudo dnf -y install python-gmpy2

How To Uninstall python-gmpy2 on CentOS 7

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

sudo dnf remove python-gmpy2

References

Summary

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