问题描述:

When using virtualenv in combination with the MinGW compiler on Windows, compiling a C extension results in the following error:

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

What should one do to successfully compile C extensions?

网友答案:

Set the LIBRARY_PATH environment variable so MinGW knows where to find the system-wide Python libpython25.a.

Place a line in your virtualenv's activate.bat:

set LIBRARY_PATH=c:\python25\libs

Or set a global environment variable in Windows.

Be sure to change 25 to correspond to your version of Python if you're not using version 2.5.

相关阅读:
Top