How To Install python-cjson on CentOS 7

In this tutorial we learn how to install python-cjson on CentOS 7. python-cjson is Fast JSON encoder/decoder for Python

Introduction

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

What is python-cjson

This module implements a very fast JSON encoder/decoder for Python. JSON stands for JavaScript Object Notation and is a text based lightweight data exchange format which is easy for humans to read/write and for machines to parse/generate. JSON is completely language independent and has multiple implementations in most of the programming languages, making it ideal for data exchange and storage. The module is written in C and it is up to 250 times faster when compared to the other python JSON implementations which are written directly in python. This speed gain varies with the complexity of the data and the operation and is the the range of 10-200 times for encoding operations and in the range of 100-250 times for decoding operations.

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

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

sudo yum -y install python-cjson

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

sudo dnf -y install python-cjson

How To Uninstall python-cjson on CentOS 7

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

sudo dnf remove python-cjson

References

Summary

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