How To Install python3-gpg on Debian 11

In this tutorial we learn how to install python3-gpg on Debian 11. python3-gpg is Python interface to the GPGME GnuPG encryption library (Python 3)

Introduction

In this tutorial we learn how to install python3-gpg on Debian 11.

What is python3-gpg

python3-gpg is:

The “gpg” Python module is, for the most part, a direct interface to the C GPGME library. However, it is re-packaged in a more Pythonic way – object-oriented with classes and modules. Take a look at the classes defined here – they correspond directly to certain object types in GPGME for C.

Features:

  • Feature-rich, full implementation of the GPGME library. Supports all GPGME features except interactive editing (coming soon). Callback functions may be written in pure Python.
  • Ability to sign, encrypt, decrypt, and verify data.
  • Ability to list keys, export and import keys, and manage the keyring.
  • Fully object-oriented with convenient classes and modules.

This is the official upstream Python 3 binding for GPGME.

There are three methods to install python3-gpg on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python3-gpg Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install python3-gpg

Install python3-gpg Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python3-gpg

Install python3-gpg 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 Debian. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install python3-gpg

How To Uninstall python3-gpg on Debian 11

To uninstall only the python3-gpg package we can use the following command:

sudo apt-get remove python3-gpg

Uninstall python3-gpg And Its Dependencies

To uninstall python3-gpg and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove python3-gpg

Remove python3-gpg Configurations and Data

To remove python3-gpg configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge python3-gpg

Remove python3-gpg configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python3-gpg

Dependencies

python3-gpg have the following dependencies:

References

Summary

In this tutorial we learn how to install python3-gpg package on Debian 11 using different package management tools: apt, apt-get and aptitude.