How To Install python-yaml on Ubuntu 20.04

In this tutorial we learn how to install python-yaml on Ubuntu 20.04. python-yaml is YAML parser and emitter for Python YAML parser and emitter for Python

Introduction

In this tutorial we learn how to install python-yaml on Ubuntu 20.04.

What is python-yaml

python-yaml is:

Python-yaml is a complete YAML 1.1 parser and emitter for Python. It can parse all examples from the specification. The parsing algorithm is simple enough to be a reference for YAML parser implementors. A simple extension API is also provided. The package is built using libyaml for improved speed.

Package: python-yaml Architecture: amd64 Version: 5.3.1-1 Priority: optional Section: universe/python Source: pyyaml Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Debian Python Modules Team [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 544 Depends: python2 (« 2.8), python2 (>= 2.7~), python2:any (« 2.8), python2:any (>= 2.7~), libc6 (>= 2.14), libyaml-0-2 Filename: pool/universe/p/pyyaml/python-yaml_5.3.1-1_amd64.deb Size: 130308 MD5sum: 1a8e944263d07da8cabef6a370c515d9 SHA1: cfe106eb43794a7ad0a0bbe3f76d94bb75890b99 SHA256: ce18a862a1b96c652786dcedb0a5be0cf7632ba1dbcd430ec2472913bbbc691d Homepage: https://github.com/yaml/pyyaml Description-en: YAML parser and emitter for Python Python-yaml is a complete YAML 1.1 parser and emitter for Python. It can parse all examples from the specification. The parsing algorithm is simple enough to be a reference for YAML parser implementors. A simple extension API is also provided. The package is built using libyaml for improved speed.

There are three methods to install python-yaml on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-yaml Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-yaml using apt-get by running the following command:

sudo apt-get -y install python-yaml

Install python-yaml Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-yaml using apt by running the following command:

sudo apt -y install python-yaml

Install python-yaml Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-yaml using aptitude by running the following command:

sudo aptitude -y install python-yaml

How To Uninstall python-yaml on Ubuntu 20.04

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

sudo apt-get remove python-yaml

Uninstall python-yaml And Its Dependencies

To uninstall python-yaml and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove python-yaml

Remove python-yaml Configurations and Data

To remove python-yaml configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge python-yaml

Remove python-yaml configuration, data, and all of its dependencies

We can use the following command to remove python-yaml configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-yaml

References

Summary

In this tutorial we learn how to install python-yaml package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.