Django/Python Beginner: Error when executing python manage.py syncdb - psycopg2 not found
There seems to be a problem with your psycopg2
installation – Python does not find it. This is a Python installation problem, not a Django issue.
You can try to load it manually using the Python interpreter and see if it works:
$ python
>>> import psycopg2
If you get an ImportError
exception, your installation is erroneous. To get a list of all directories Python looks for modules, use sys.path
:
$ python
>>> import sys
>>> print sys.path
You can also add custom directories to Python's module search path by modifying the sys.path
variable. Do this somewhere before the respective import
statement(s):
import sys
sys.path.append("my-path")
# ...
import psycopg2
If you have pip
installed, simply install the missing extension by running:
$ pip install psycopg2
For the record I got the same error for a different reason:
I had put
'ENGINE': 'django.db.backends.postgresql'
instead of
'ENGINE': 'django.db.backends.postgresql_psycopg2'
in settings.py