I Installed psycopg2 using pip
C:\Users\username>python -m pip install psycopg2
Adjusted my settings to:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # also tried: django.db.backends.postgresql
'NAME': 'name',
'USER': 'user',
'PASSWORD': 'my_password',
'HOST': 'localhost',
'PORT': '5432',
}
}
When I attempt to run the server:
import psycopg2 as Database ImportError:
No module named 'psycopg2'
So I ran this again and got:
python -m pip install psycopg2 Requirement already satisfied (use --upgrade to upgrade): psycopg2 in ...
So what have I done wrong? I am new to Django
There is a possibility that you have two versions of python installed and python2-pip
is aliased as pip
while python3-pip
is aliased as pip3
.
Make sure you are using right version with python
and pip
.
So the command would be:
pip3 install psycopg2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With