Python 3.x 在windows 7下使用python 3.3(Anaconda)构建最小cython文件
当我试图在windows 7下用Python 3.3(Anaconda 3)构建一个最小的Cython文件test.pyx时,我得到了一个奇怪的错误:Python 3.x 在windows 7下使用python 3.3(Anaconda)构建最小cython文件,python-3.x,windows-7,cython,anaconda,Python 3.x,Windows 7,Cython,Anaconda,当我试图在windows 7下用Python 3.3(Anaconda 3)构建一个最小的Cython文件test.pyx时,我得到了一个奇怪的错误: 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在工作目录中。它在windows
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在工作目录中。它在windows和Python2.7(Anaconda)下运行良好,在Linux和Python2和3下运行良好
Python3.3(Anaconda3)有什么问题
谢谢
文件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行不完整
out_string = check_output(['gcc', '-dumpmachine'])
out_string = check_output(['gcc', '-dumpmachine'])
必须更改为
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
然后,它会正常编译。包distils的cygwinccompiler.py文件的第404行
out_string = check_output(['gcc', '-dumpmachine'])
out_string = check_output(['gcc', '-dumpmachine'])
必须更改为
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
然后,它会正常编译