简体   繁体   中英

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

On Windows, make sure your path includes the Postgres bin directory. In my machine it's 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.

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

尝试运行以下命令:

pip install psycopg2-binary

It is a problem with virtualenv and psycopg2 . I have copied _psycopg.cp38-win_amd64.pyd from global python to \\venv\\Lib\\site-packages\\psycopg2 This worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM