How To Install python-pysqlite2 on Debian 9

In this tutorial we learn how to install python-pysqlite2 on Debian 9. python-pysqlite2 is Python interface to SQLite 3

Introduction

In this tutorial we learn how to install python-pysqlite2 on Debian 9.

What is python-pysqlite2

python-pysqlite2 is:

pysqlite is a DB-API 2.0-compliant database interface for SQLite.

This package is built against SQLite 3. For an interface to SQLite 2, see the package python-sqlite. An alternative Python SQLite 3 module is packaged as python-apsw.

SQLite is a relational database management system contained in a relatively small C library. It is a public domain project created by D. Richard Hipp. Unlike the usual client-server paradigm, the SQLite engine is not a standalone process with which the program communicates, but is linked in and thus becomes an integral part of the program. The library implements most of SQL-92 standard, including transactions, triggers and most of complex queries.

pysqlite makes this powerful embedded SQL engine available to Python programmers. It stays compatible with the Python database API specification 2.0 as much as possible, but also exposes most of SQLite’s native API, so that it is for example possible to create user-defined SQL functions and aggregates in Python.

If you need a relational database for your applications, or even small tools or helper scripts, pysqlite is often a good fit. It’s easy to use, easy to deploy, and does not depend on any other Python libraries or platform libraries, except SQLite. SQLite itself is ported to most platforms you’d ever care about.

It’s often a good alternative to MySQL, the Microsoft JET engine or the MSDE, without having any of their license and deployment issues.

There are three methods to install python-pysqlite2 on Debian 9. 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-pysqlite2 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-pysqlite2 using apt-get by running the following command:

sudo apt-get -y install python-pysqlite2

Install python-pysqlite2 Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-pysqlite2

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

sudo aptitude -y install python-pysqlite2

How To Uninstall python-pysqlite2 on Debian 9

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

sudo apt-get remove python-pysqlite2

Uninstall python-pysqlite2 And Its Dependencies

To uninstall python-pysqlite2 and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove python-pysqlite2

Remove python-pysqlite2 Configurations and Data

To remove python-pysqlite2 configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge python-pysqlite2

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

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

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

Dependencies

python-pysqlite2 have the following dependencies:

References

Summary

In this tutorial we learn how to install python-pysqlite2 package on Debian 9 using different package management tools: apt, apt-get and aptitude.