Install Psycopg2 on Linux Mint 19.2

Hello, welcome to another Linux Mint tutorial. Today, I am going to show you how to install the Python-PostgreSQL module, psycopg2. Psycopg2 is a popular module for Python which can be used to connect Python to PostgreSQL database. Well, I am currently starting to learn Python myself and I like the database section.

I am running on Linux Mint 19.2 and to install psycopg2, we can easily use the apt install command. This command should works on Ubuntu and Debian as well. So, here is the command to install psycopg2

sudo apt install python3-dev python-psycopg2 

Now let’s check if it installed correctly.

sudo dpkg -l | grep psycopg2

Check the output and you should see something like this

ii python-psycopg2 2.7.4-1 amd64 Python module for PostgreSQL

Done. Now, you can start using psycopg2 on your Python script. Next, I will share how to use psycopg2 to connect Python with PostgreSQL database. Cheers.

Be the first to comment

Leave a Reply