python -m pip install psycopg2 Adjusted my settings...">

There is no module called "psycopg2"

I installed psycopg2 using pip

C:\Users\username>python -m pip install psycopg2

Adjusted my settings:

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 try to start the server:

import psycopg2 as an ImportError database:

No module named "psycopg2"

So, I ran again and got:

python -m pip install psycopg2 The requirement has already been met (use --upgrade to upgrade): psycopg2 in ...

So what have I done wrong? I'm new to Django

+4
source share
4 answers

It’s possible that after the installation tutorial you installed virtualenv, created some environment (for example env1) and installed django on this environment.

, django ( ). , pip.

+2

, python, python2-pip - pip, python3-pip - pip3.

, python pip.

, :

pip3 install psycopg2
+5

whl, :

pip install psycopg2-2.6.2-cp27-cp27m-win_amd64.whl

http://www.lfd.uci.edu/~gohlke/pythonlibs/

+4

pip install psycopg2-binary
0

Source: https://habr.com/ru/post/1661965/


All Articles