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”.
Installation:
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__)"