加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 错误:Mac上没有名为psycopg2.extensions的模块

发布时间:2020-12-16 22:05:21 所属栏目:Python 来源:网络整理
导读:当我尝试运行django时,这就是我得到的: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python manage.py runserver 8000Error: No module named psycopg2.extensionsProcess finished with exit code 1 我发现了其他有类似问题的问题,但是

当我尝试运行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

我发现了其他有类似问题的问题,但是在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.
    }
}
最佳答案
正如你在source code中看到的那样,Django使用了psycopg2.extensions模块.此外,扩展模块在psycopg2中为oficially contained.所以,我认为你以错误的方式安装了psycopg.

这是安装页面的正确位置:http://initd.org/psycopg/install/

我建议你使用virtualenv

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读