How To Install python-pathlib on CentOS 7

In this tutorial we learn how to install python-pathlib on CentOS 7. python-pathlib is Object-oriented filesystem paths

Introduction

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

What is python-pathlib

pathlib offers a set of classes to handle filesystem paths. It offers the following advantages over using string objects * No more cumbersome use of os and os.path functions. Everything can be done easily through operators, attribute accesses, and method calls. * Embodies the semantics of different path types. For example, comparing Windows paths ignores casing. * Well-defined semantics, eliminating any warts or ambiguities (forward vs. backward slashes, etc.). It’s part of Python 3.4+ standard library.

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

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

sudo yum -y install python-pathlib

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

sudo dnf -y install python-pathlib

How To Uninstall python-pathlib on CentOS 7

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

sudo dnf remove python-pathlib

References

Summary

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