Windows 8上安装Python psycopg2-2.5.1

0 投票
1 回答
588 浏览
提问于 2025-04-18 11:11

我在安装Python的psycopg2库时遇到了问题,编译失败了。我的操作系统是64位的Windows 8,使用的Python版本是2.7,还有mingw-w64这个工具。

C:/mingw-w64/x86_64-4.9.0-win32-seh-rt_v3-rev2/mingw64/bin/../lib/gcc/x86_64-w64
-mingw32/4.9.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27

collect2.exe: error: ld returned 1 exit status
error: command 'C:\\mingw-w64\\x86_64-4.9.0-win32-seh-rt_v3-rev2\\mingw64\\bin\\
gcc.exe' failed with exit status 1

1 个回答

2

找不到 -lpython27

python27.lib 文件不在你的 LIBRARY_PATH 中。具体原因很难说,因为你没有解释你是怎么到这个地步的,比如你运行了哪些命令,安装了哪个版本的Python等等。

无论如何,我强烈建议你直接使用二进制安装包。你可以参考以下已有的回答:

撰写回答