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