2012-10-23 54 views
0

我想編譯一些Python/Numpy代碼到Cython中以加速。我可以編譯我的桌面上就好了 - 我抄我.pyx用Cython文件到我的筆記本電腦來運行它,並試圖編譯後,我得到以下錯誤:無法編譯Cython代碼 - 無法識別的命令行選項'-mno-cygwin'

C:\Python27\MATH7450>python setup.py build_ext --inplace 
running build_ext 
cythoning heat.pyx to heat.c 
building 'heat' extension 
C:\strawberry\c\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\lib\site-pa 
ckages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c heat.c -o bu 
ild\temp.win32-2.7\Release\heat.o 
cc1.exe: error: unrecognized command line option '-mno-cygwin' 
error: command 'gcc' failed with exit status 1 

我運行Windows 7 64位。我看到它使用草莓perl。我有32位版本的草莓perl安裝。再次,它在我的桌面上工作得很好,但是在移植到筆記本電腦時遇到這個奇怪的錯誤。

回答

2

根據Windows installation instructions of Cython,推薦的編譯器是免費的Visual C++ 2008 Express,它可以從脫機安裝Visual Studio 2008 Express iso安裝。

或者Cython can use the MinGW and its gcc,雖然這是一個reportedly more difficult route

從包含在您的問題中的輸出中,Cython試圖使用包含在草莓Perl分發中的MinGW安裝。

我的建議是安裝Visual C++ 2008 Express,根據我的經驗,它最適合編譯Cython或其他Python C擴展模塊。

相關問題