我有一个类似于ImportError: DLL load failed : - 尝试导入 psycopg2 库时的问题
我正在尝试使用使用 Visual Studio 2008 (vc9) 构建的 Python 2.6.5 运行 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”。那是什么?
- 埃里克