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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1306367/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:48:20  来源:igfitidea点击:

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

pythondjangopostgresqlpsycopg2

提问by john2x

>>> 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. I've tried installing the Visual C++ 2008 Package, but I still get the same error.

尝试导入psycopg2时出现此错误。我已经搜索了几天,但没有找到解决方案。我已尝试安装 Visual C++ 2008 包,但仍然遇到相同的错误。

采纳答案by pkit

According to this threadyou 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 系列。

回答by Carlos A. Ibarra

On Windows, make sure your path includes the Postgres bin directory. In my machine it's c:\Programs\PostgreSQL\9.3\bin.

在 Windows 上,确保您的路径包含 Postgres bin 目录。在我的机器中,它是 c:\Programs\PostgreSQL\9.3\bin。

回答by Benny Pasternak

You can also try installing win-psycopg from here

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