Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to install pyscopg2 package in Python?

  • Difficulty Level : Easy
  • Last Updated : 05 Oct, 2021

psycopg2 is the most popular PostgreSQL database adapter for the Python programming language. It is a DB API 2.0 compliant PostgressSQL 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.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

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
Recommended Articles
Page :

Start Your Coding Journey Now!