如何在virtualenv中使用MinGW编译Python C扩展?
问题描述:
当结合使用的virtualenv在Windows上使用MinGW的编译器,编译以下错误C扩展的结果:如何在virtualenv中使用MinGW编译Python C扩展?
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lpython25 collect2: ld returned 1 exit status error: Setup script exited with error: command 'gcc' failed with exit status 1
应该怎样做一个成功编译C扩展?
答
设置LIBRARY_PATH
环境变量,以便MinGW知道在哪里可以找到系统范围的Python libpython25.a
。
放置在一个行你的virtualenv的activate.bat
:
set LIBRARY_PATH=c:\python25\libs
或者在Windows中设置一个全球性的环境变量。
如果您不使用版本2.5,请确保将25
更改为与您的Python版本相对应。
非常感谢您用答案更新您的问题。正在与同样的问题挣扎,这是问题! – aravenel 2012-08-23 15:44:18