ImportError:导入_psycopg时DLL加载失败:找不到指定的模块

罗斯

我有一个django项目,我正在尝试与postgres数据库连接。但是,当我尝试运行命令时python manage.py makemigrations,出现以下错误:

(card_crate_venv) G:\Shared drives\Card Crate\Software Development\card_crate_admin\website>python manage.py makemigrations
Traceback (most recent call last):
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\website\manage.py", line 22, in <module>
    main()
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\website\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\card_crate_venv\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\card_crate_venv\lib\site-packages\django\core\management\__init__.py", line 377, in execute
    django.setup()
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\card_crate_venv\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\card_crate_venv\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\card_crate_venv\lib\site-packages\django\apps\config.py", line 90, in create
    module = import_module(entry)
  File "C:\Users\Ross Waston\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "G:\Shared drives\Card Crate\Software Development\card_crate_admin\card_crate_venv\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.

settings.py:

INSTALLED_APPS = [
    'psycopg2',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'dashboard.apps.DashboardConfig',
]

...

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'development',
        'USER': 'superuser',
        'PASSWORD': 'admin',
        'HOST': '192.168.1.100',
        'PORT': '5432',
    }
}

套餐:

在此处输入图片说明

罗斯

我发现这不起作用,因为我使用的是python 3.9作为解释器。在PyCharm中,我创建了一个新的解释器,将基本解释器设置为python 3.7,然后重新安装了所有我需要的软件包,使其按预期工作

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

尝试导入sklearn模块时出错:ImportError:DLL加载失败:找不到指定的模块

cx_Freeze ImportError:导入_ctypes时,DLL加载失败失败:找不到指定的模块

发生异常:导入pdftotext时,ImportError DLL加载失败:找不到指定的模块

ImportError:导入pyexpat时DLL加载失败:找不到指定的模块

DLL加载失败:导入scipy时找不到指定的模块

从scipy.linalg导入_fblas:ImportError:DLL加载失败:找不到指定的模块

ImportError:DLL加载失败:找不到numpy的指定模块

pyodbc ImportError:DLL加载失败:找不到指定的模块

Python:ImportError:DLL加载失败:找不到指定的模块

ImportError:DLL加载失败:找不到指定的模块

ImportError:DLL加载失败:找不到指定的模块

NLTK ImportError:DLL加载失败:找不到指定的模块

Scipy ImportError:DLL加载失败:找不到指定的模块

skimage-ImportError:DLL加载失败:找不到指定的模块

ImportError:DLL加载失败:找不到指定的模块(sklearn)

ktrain ImportError:DLL加载失败:找不到指定的模块

MeCab:“ ImportError:DLL加载失败:找不到指定的模块。”

导入错误:DLL 加载失败:找不到指定的模块。在尝试导入 TensorFlow 时

Pyinstaller:导入错误:DLL加载失败:找不到指定的模块

Pyinstaller 导入错误:DLL 加载失败:找不到指定的模块

使用conda从Anaconda导入numpy时出错(DLL加载失败:找不到指定的模块)

从 sklearn 导入“kfold”时出现“DLL 加载失败:找不到指定的模块”错误

导入错误:DLL加载失败:使用cxfreeze时找不到指定的模块

导入ft2font时DLL加载失败:找不到指定的模块

如何绕过kivy模块错误:ImportError:DLL加载失败:找不到指定的模块?

导入matplotlib._png作为_png导入:错误:DLL加载失败:找不到指定的模块

收到错误“ DLL加载失败:找不到指定的模块”。在尝试使用PyCharm在Anaconda中导入Windows的Tensorflow时

无法导入PIL的'_imaging'模块:DLL加载失败:找不到指定的模块

尝试安装 TensorFlow-GPU...因导入错误而失败:DLL 加载失败:找不到指定的模块