DzITC
DzITC

Reputation: 879

Module 'psycopg2' "PostGreSQL" not found

I tried:

pip3 install psycopg2, pip install psycopg2,

Requirement already satisfied: psycopg2 in
c:\users\dzitc\appdata\local\programs\python\python37-32\lib\site-packages (2.8.3)

In test.py I imported the psycopg2 by:

import psycopg2

When debugging the test.py I get results as :

Exception has occurred: ModuleNotFoundError No module named 'psycopg2'
File "C:\Users\DzITC\Desktop\PYFiles\Main.py", line 7, in <module> import psycopg2

Upvotes: 0

Views: 384

Answers (2)

DzITC
DzITC

Reputation: 879

I fixed it by changing the Python IDE interpreter.

Upvotes: 1

ipaleka
ipaleka

Reputation: 3967

Try with:

python -m pip install psycopg2-binary

as that would install psycopg2 for your system Python.

Try to run your script with:

python path_to_script\test.py

I guess you're trying to run test.py some other way, like double-click and maybe you've associated .py files to some other Python executable.

Upvotes: 0

Related Questions