ImportError: DLL load failed : - when trying to im

2019-02-04 15:38发布

问题:

>>> 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.

回答1:

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:

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



回答3:

You can also try installing win-psycopg from here