当我尝试运行django时,这就是我得到的:
/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
@H_404_8@我发现了其他有类似问题的问题,但是在mac上没有问题,没有解决方案有帮助.我没有得到任何其他错误,我安装了psycopg2.我在PyCharm工作.这是我的设置文件(或至少是它的顶部).
ADMINS = ( # ('Your Name','your_email@example.com'),) 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. } }
@H_404_8@
最佳答案
正如你在source code中看到的那样,Django使用了psycopg2.extensions模块.此外,扩展模块在psycopg2中为oficially contained.所以,我认为你以错误的方式安装了psycopg.
这是安装页面的正确位置:http://initd.org/psycopg/install/
我建议你使用virtualenv