Skip to content
Related Articles
Open in App
Not now

Related Articles

How to install pyscopg2 package in Python?

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 21 Feb, 2023
Improve Article
Save Article

psycopg2 is the most popular PostgreSQL database adapter for the Python programming language. It is a DB API 2.0 compliant PostgreSQL driver is actively developed. It is designed for heavily multi-threaded applications that create and destroy lots of cursors and create a large number of “INSERTs” or “UPDATEs”. 


To install this module follow the below steps.

Step 1: First of all check whether Python is installed or not in your system. Do it by simply printing its version. Open the command prompt and run the command given below:

python --version

If python is not installed in your system, then you can install it running the given command in your command prompt. 

pip install python

Step 2: Open the command prompt and run the below command in the command prompt. If it shows successfully installed then you are good to go.

pip install psycopg2

Step 3: Check if it is working or not. Do it simply by importing psycopg2 library and checking its version. Open the command prompt and put the command given below. Showing no error means our package is successfully installed.

python -c "import psycopg2; print(psycopg2.__version__)"

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!