我有一个类似于ImportError: DLL load failed : - when trying to import psycopg2 library的问题。
我正在尝试使用Python 2.6.5和Visual Studio 2008(vc9)构建运行psycopg2。但是,我遇到了以下错误:
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The operating system cannot run %1.
来自PostGres 8.4的libpg.dll已经在路径中。如果我使用vc6构建的Python生成psycopg2,那么它将可以正常运行。但问题是我需要它与vc9构建的Python一起工作。
我参考的页面提到了使用旧版本。当我尝试构建版本2.12.0(甚至是2.10.0)时,我会收到以下错误:
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W
3 /GS- /DNDEBUG -DPSYCOPG_DEFAULT_PYDATETIME=1 "-DPSYCOPG_VERSION=\"2.0.10 (dt d
ec ext pq3)\"" -DPG_VERSION_HEX=0x080401 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BO
OLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -IC:\Python26\include -IC:\Pytho
n26\PC -I. -Ic:/apps/POSTGR~1/8.4/include -Ic:/apps/POSTGR~1/8.4/include/server
/Tcpsycopg\connection_int.c /Fobuild\temp.win32-2.6\Release\psycopg\connection_i
nt.obj /Wp64
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be
removed in a future release
connection_int.c
psycopg\connection_int.c(70) : error C2143: syntax error : missing ';' before 't
ype'
psycopg\connection_int.c(71) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(71) : warning C4047: '=' : 'int' differs in levels of i
ndirection from 'connectionObject_notice *'
psycopg\connection_int.c(73) : error C2065: 'notice' : undeclared identifier
psycopg\connection_int.c(73) : warning C4047: '!=' : 'int' differs in levels of
indirection from 'void *'
不断重复......查看C代码,没有条件代码包装struct connectionObject_notice的定义,因此我不知道会触发什么错误。
最后,上面的帖子中有人提到“PG6000”。那是什么?
- Eric