Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: No module named psycopg2.extensions on Mac

When I try and run django, this is what I get:

    /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python manage.py runserver 8000
Error: No module named psycopg2.extensions

Process finished with exit code 1

I've found other questions with similar problems but none on a mac and none with solutions that help. I get no other errors and I installed psycopg2. Im working in PyCharm. This is my setting file (or the top part of it at least).

ADMINS = (
    # ('Your Name', '[email protected]'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '---',                      # Or path to database file if using sqlite3.
        'USER': '---',                      # Not used with sqlite3.
        'PASSWORD': '---',                  # Not used with sqlite3.
        'HOST': 'www.-----.com',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}
like image 896
sinθ Avatar asked Oct 07 '22 10:10

sinθ


1 Answers

As you can see in the source code, Django makes havy use of psycopg2.extensions module. Further, the extensions module is oficially contained in psycopg2. So, what I think is that you have installed psycopg the wrong way.

Here's the right location of the install page: http://initd.org/psycopg/install/

I recommend you to use virtualenv

like image 121
santiagobasulto Avatar answered Oct 13 '22 10:10

santiagobasulto