简体   繁体   English

导入错误:DLL 加载失败:-尝试导入 psycopg2 库时

[英]ImportError: DLL load failed : - when trying to import psycopg2 library

>>> import psycopg2
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python26\lib\site-packages\psycopg2\__init__.py", line 60, in 
    from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The application has failed to start because its si
de-by-side configuration is incorrect. Please see the application event log for
more detail.

I get this error when trying to import psycopg2 .. I've searched for days, and found no solutions.尝试导入psycopg2时出现此错误。我已经搜索了几天,但没有找到解决方案。 I've tried installing the Visual C++ 2008 Package, but I still get the same error.我已尝试安装 Visual C++ 2008 包,但仍然遇到相同的错误。

On Windows, make sure your path includes the Postgres bin directory.在 Windows 上,确保您的路径包含 Postgres bin 目录。 In my machine it's c:\\Programs\\PostgreSQL\\9.3\\bin.在我的机器上它是 c:\\Programs\\PostgreSQL\\9.3\\bin。

According to this thread you need to install an earlier version since there were problems with the latest build.根据此线程,您需要安装早期版本,因为最新版本存在问题。

Simply install an earlier version, (2.0.10 works great), even with PostgreSQL 8.4.x series.只需安装早期版本(2.0.10 效果很好),即使是 PostgreSQL 8.4.x 系列。

您也可以尝试从这里安装 win-psycopg

尝试运行以下命令:

pip install psycopg2-binary

It is a problem with virtualenv and psycopg2 .这是virtualenvpsycopg2的问题。 I have copied _psycopg.cp38-win_amd64.pyd from global python to \\venv\\Lib\\site-packages\\psycopg2 This worked for me.我已将_psycopg.cp38-win_amd64.pyd从全局 python 复制到\\venv\\Lib\\site-packages\\psycopg2这对我\\venv\\Lib\\site-packages\\psycopg2

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 错误:ImportError: DLL 在 Python 3.7 上使用 psycopg2 加载失败 - Python error: ImportError: DLL Load failed with psycopg2 on Python 3.7 psycopg2 - 导入错误:DLL 导入 _psycopg 时加载失败:操作系统无法运行 %1 - psycopg2 - ImportError: DLL load failed while importing _psycopg: The operating system cannot run %1 ImportError:DLL加载失败-尝试导入spynner时 - ImportError: DLL load failed - when trying to import spynner 尝试在 Windows 上导入 pymssql 时出现“ImportError: DLL load failed” - “ImportError: DLL load failed” when trying to import pymssql on Windows python错误ImportError:DLL加载失败:找不到指定的过程。 __load中的文件“ psycopg2 \\ _psycopg.pyc”,第10行 - python error ImportError: DLL load failed: The specified procedure could not be found. File “psycopg2\_psycopg.pyc”, line 10, in __load 尝试导入 sklearn 模块时出错:ImportError:DLL 加载失败:找不到指定的模块 - Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found ImportError:DLL加载失败:找不到指定的模块。 尝试“从PIL导入图像”时 - ImportError: DLL load failed: The specified module could not be found. when trying to “from PIL import Image” 尝试导入 Tensorflow 时 DLL 加载失败 - DLL load failed when trying to import Tensorflow ImportError:无法导入名称tz(psycopg2) - ImportError: cannot import name tz (psycopg2) Python 3.7和psycopg2。 ImportError:DLL加载失败 - Python 3.7 and psycopg2. ImportError: DLL load failed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM