6
當我嘗試建立與Python 3.3(蟒蛇3)最小用Cython文件test.pyx在Windows 7下,我得到奇怪的錯誤:windows下建立最小用Cython文件與Python 3.3(Anaconda)的7
C:\Users\myname\Test_cython>python setup.py build
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
當然test.pyx在工作目錄中。它在Python 2.7(Anaconda)的windows下以及Python 2和3的Linux下正常工作。
Python 3.3(Anaconda 3)有什麼問題?
由於
文件setup.py:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
name = 'test',
cmdclass = {"build_ext": build_ext},
ext_modules = [Extension('test', ['test.pyx'])]
)
解決方案:
我發現包的文件cygwinccompiler.py的線404 disutils
out_string = check_output(['gcc', '-dumpmachine'])
必須更改爲
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
然後,它正常編譯。
http://bugs.python.org/issue21821 – asmeurer