Nora
Nora

Reputation: 1893

How to solve the error: "No module named psycopg2" (postgreSQL and Django)?

I am quite new to Django, and this is my first time setting up a Databse. I followed tutorials, and created a virtual environment. In this virtual environment, the package psycopg2 is installed (as you can see in the image below).

enter image description here

However, when I use the command "python manage.py migrate", the following error appears: "No module named psycopg2". This is strange, because it seems like psycopg2 is installed, and the right virtual environment is linked with PyCharm.

For the record, I checked similar questions on Stack Overflow, and the solution was usually that "pip install psycopg2" was not used. However, I have done this.

Any guidance would be truly appreciated!

Upvotes: 0

Views: 903

Answers (1)

Ajmal Noushad
Ajmal Noushad

Reputation: 946

I think you didn't activate the virtualenv before you did python manage.py migrate.

Activate the vitualenv and try again

Upvotes: 1

Related Questions