Can I get psycopg2 to work with Windows using python created using vc9?

I have a question similar to ImportError: DLL loading error: - when trying to import the psycopg2 library

I am trying to run psycopg2 with Python 2.6.5 created using Visual Studio 2008 (vc9). I get this error:

from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The operating system cannot run %1.

libpg.dll, from PostGres 8.4, is on the way. If I create psycopg2 with a vc6-built python, it will work well. But the problem is that I need it to work with VC9-built Python.

The page that I link to is mentioned in the old version. When I try to build version 2.12.0 (or even 2.10.0), I get this error:

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

+3
1

, Windows SDK 7.0.

vs2005/vs2008/vc2010 SDK, , python psycopg2-2.4.2, "python setup.py install",
"mt.exe"; "C:\Program Files (x86)\Microsoft SDK\Windows\v7.0A\Bin" , . python -c "import psycopg2" , PostgreSQL: "...\PostgreSQL\8.4\bin" , .

+2

Source: https://habr.com/ru/post/1742525/


All Articles