簡體   English   中英

嘗試安裝psycopg2時“找不到-lpq”

[英]“cannot find -lpq” when trying to install psycopg2

簡介 :我正在嘗試將Trac SQLite遷移到PostgreSQL后端,為此我需要psycopg2。 單擊www.initd.org上令人尷尬的選項后,我下載了最新版本並嘗試運行setup.py install 這沒用,告訴我我需要mingw。 因此,我下載並安裝了mingw。

問題 :運行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

我嘗試過的 -我注意到-L選項中的正斜杠,因此我在setup.cfg的library_dirs選項中手動輸入了我的PostgreSQL lib目錄,但無濟於事(該調用中有一個帶有反斜杠的-L選項,但錯誤消息保持不變)。

您是否嘗試過Windows的psycopg2的二進制版本 如果這適用於您的python,則可以減輕手工構建的需要。

我已經看到隨機的人在各種各樣的列表上問這個問題,似乎一個建議是手工構建postgresql來解決這個問題。

在Windows上編譯擴展可能很棘手。 但是,有可用的預編譯庫: http : //www.stickpeople.com/projects/python/win-psycopg/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM