pau*_*ier 8 cython windows-7 python-3.x 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
Run Code Online (Sandbox Code Playgroud)
当然test.pyx在工作目录中.它在使用Python 2.7(Anaconda)的Windows下运行,在Linux下使用Python 2和3运行良好.
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'])]
)
Run Code Online (Sandbox Code Playgroud)
解:
我发现包的文件cygwinccompiler.py的404行disutils
out_string = check_output(['gcc', '-dumpmachine'])
Run Code Online (Sandbox Code Playgroud)
必须改为
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
Run Code Online (Sandbox Code Playgroud)
然后,它正常编译.
包的文件cygwinccompiler.py的404行disutils
out_string = check_output(['gcc', '-dumpmachine'])
Run Code Online (Sandbox Code Playgroud)
必须改为
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
Run Code Online (Sandbox Code Playgroud)
然后,它正常编译.