Error: No module named psycopg2.extensions on Mac

12,209

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

Share:
12,209
sinθ
Author by

sinθ

Updated on June 15, 2022

Comments

  • sinθ
    sinθ almost 2 years

    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.
        }
    }