Question

Intro : j'essaie de migrer notre Trac SQLite vers un serveur PostgreSQL. Pour ce faire, j'ai besoin de psycopg2. Après avoir cliqué au-delà du discours embarrassant sur www.initd.org, j'ai téléchargé la dernière version et essayé d'exécuter setup.py install . Cela n'a pas fonctionné, me disant que j'avais besoin de mingw. J'ai donc téléchargé et installé mingw.

Problème : le message d'erreur suivant s'affiche lorsque j'exécute setup.py build_ext --compiler = mingw32 install :

running build_ext
building 'psycopg2._psycopg' extension
writing build\temp.win32-2.4\Release\psycopg\_psycopg.def
C:\mingw\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.4\Release\psycopg
\psycopgmodule.o build\temp.win32-2.4\Release\psycopg\pqpath.o build\temp.win32-
2.4\Release\psycopg\typecast.o build\temp.win32-2.4\Release\psycopg\microprotoco
ls.o build\temp.win32-2.4\Release\psycopg\microprotocols_proto.o build\temp.win3
2-2.4\Release\psycopg\connection_type.o build\temp.win32-2.4\Release\psycopg\con
nection_int.o build\temp.win32-2.4\Release\psycopg\cursor_type.o build\temp.win3
2-2.4\Release\psycopg\cursor_int.o build\temp.win32-2.4\Release\psycopg\lobject_
type.o build\temp.win32-2.4\Release\psycopg\lobject_int.o build\temp.win32-2.4\R
elease\psycopg\adapter_qstring.o build\temp.win32-2.4\Release\psycopg\adapter_pb
oolean.o build\temp.win32-2.4\Release\psycopg\adapter_binary.o build\temp.win32-
2.4\Release\psycopg\adapter_asis.o build\temp.win32-2.4\Release\psycopg\adapter_
list.o build\temp.win32-2.4\Release\psycopg\adapter_datetime.o build\temp.win32-
2.4\Release\psycopg\_psycopg.def -LC:\Python24\libs -LC:\Python24\PCBuild -Lc:/P
ROGRA~1/POSTGR~1/8.3/lib -lpython24 -lmsvcr71 -lpq -lmsvcr71 -lws2_32 -ladvapi32
 -o build\lib.win32-2.4\psycopg2\_psycopg.pyd
C:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot fin
d -lpq
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

Ce que j'ai essayé : j'ai remarqué les barres obliques dans l'option -L. J'ai donc entré manuellement le répertoire lib PostgreSQL dans l'option library_dirs du fichier setup.cfg (en vain). appel avait alors une option -L avec des barres obliques inverses, mais le message d'erreur est resté le même).

Était-ce utile?

La solution

Avez-vous essayé la version binaire de psycopg2 pour Windows? Si cela fonctionne avec votre python, cela atténue le besoin de construire à la main.

J'ai vu des gens au hasard poser cette question sur plusieurs listes et il semble que l'une des recommandations consiste à créer manuellement postgresql pour contourner ce problème.

Autres conseils

Compiler des extensions sur Windows peut être délicat. Il existe toutefois des bibliothèques précompilées: http://www.stickpeople.com/projects/ python / win-psycopg /

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top