简体   繁体   中英

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).

在此处输入图片说明

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!

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

Activate the vitualenv and try again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM