To access PostgreSQL databases using Python, you must install PyGreSQL package in a virtual environment. PyGreSQL package contains the pgdb module.

Log in to your Hostginger hosting account.

Create a virtual environment with command: 

cd ~
virtualenv sqlenv

Activate the virtual environment with command:
source sqlenv/bin/activate

To update pip in the virtual environment, type the following command:
pip install -U pip

To install the psycopg2 package, type the following command:
pip install pygresql
 
Was this answer helpful? 0 Users Found This Useful (0 Votes) PostgreSQL, PostgreSQL connection, PostgreSQL connection using Python PyGreSQL package