Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django postgres数据库连接-导入_psycopg时DLL加载失败:找不到指定的模块_Python_Django_Postgresql - Fatal编程技术网

Python Django postgres数据库连接-导入_psycopg时DLL加载失败:找不到指定的模块

Python Django postgres数据库连接-导入_psycopg时DLL加载失败:找不到指定的模块,python,django,postgresql,Python,Django,Postgresql,我已经尝试了许多可用的选项,但对我来说没有任何效果 这是我的环境 操作系统:Windows 10 Home 64位 Python版本:Python 3.9.0a6 Django版本:3.0.5 Postgress数据库版本:12 这是我用来建立连接的方法 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'xxxx', 'USER'

我已经尝试了许多可用的选项,但对我来说没有任何效果

这是我的环境

  • 操作系统:Windows 10 Home 64位
  • Python版本:Python 3.9.0a6
  • Django版本:3.0.5
  • Postgress数据库版本:12
这是我用来建立连接的方法

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'xxxx',
        'USER': 'postgres',
        'PASSWORD': 'admin',
        'HOST': 'localhost'
    }
}
我收到的错误

(dev-test) F:\Personal\xxxx\Learning\Django\projects\jangoproject\devtest>python manage.py startserver
Traceback (most recent call last):
  File "C:\Users\LENOVO\Envs\dev-test\lib\site-packages\django\db\backends\postgresql\base.py", line 25, in <module>
    import psycopg2 as Database
  File "C:\Users\LENOVO\Envs\dev-test\lib\site-packages\psycopg2\__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.

During handling of the above exception, another exception occurred:
(开发测试)F:\Personal\xxxx\Learning\Django\projects\jangoproject\devtest>python manage.py startserver
回溯(最近一次呼叫最后一次):
文件“C:\Users\LENOVO\Envs\dev test\lib\site packages\django\db\backends\postgresql\base.py”,第25行,在
将psycopg2作为数据库导入
文件“C:\Users\LENOVO\Envs\dev test\lib\site packages\psycopg2\\uuuuuu init\uuuuuu.py”,第51行,在
来自psycopg2._psycopg导入(#noqa
ImportError:导入时DLL加载失败_psycopg:找不到指定的模块。
在处理上述异常期间,发生了另一个异常:

您可以尝试该命令

pip install django psycopg2 
'ENGINE' : 'django.db.backends.postgresql_psycopg2',
'PORT'  : ' ' 

所以默认端口被选中了

Hi,谢谢。但是它对我不起作用,我遇到了同样的错误。在测试之前,我已经安装了上面提到的软件包。