Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am new to using Django, I am currently working on my first project in a virtual environment. I am having trouble working with psycopg2 and pillow. I am using psycopg2 so that I can connect with a postgres database. When I try to use the adapters/modules i get error saying:

Error loading psycopg2 module: No module named 'psycopg2'

when I try to pip install these tools from my virtual environment, I get message saying:

Requirement already satisfied: psycopg2 in /Users/owner/work/anaconda3/lib/python3.8/site-packages

At some point, I installed anaconda. I am working with Django in a different virtual environment, so I believe it's getting confused with the "requirement" location of anaconda vs. django virtual environment?

This location: /Users/owner/work/anaconda3/lib/python3.8/site-packages

contains psycopg2

This location: /Users/owner/django-venv/lib/python3.9/site-packages

does not contain psycopg2. so I copied the psycopg2 directory from anaconda library to django environment library:

cp -av /Users/owner/work/anaconda3/lib/python3.8/site-packages/psycopg2 /Users/owner/django-venv/lib/python3.9/site-packages

However, now I am getting error

Error loading psycopg2 module: No module named 'psycopg2._psycopg'

I don't fully understand what is going on.

Any tips on how to resolve this issue?

question from:https://stackoverflow.com/questions/65940579/python-django-virtual-environment-configuration

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
121 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...