Building minimal cython file with python 3.3 (Anaconda) under windows 7

≯℡__Kan透↙ 提交于 2019-12-30 04:37:05

问题


When I try to build a minimal Cython file test.pyx with Python 3.3 (Anaconda 3) under windows 7, I obtain a strange error:

C:\Users\myname\Test_cython>python setup.py build
running build
running build_ext
error: [WinError 2] The system cannot find the file specified

Of course test.pyx is in the working directory. It works fine under windows with Python 2.7 (Anaconda) and under Linux with Python 2 and 3.

What could be the problem here with Python 3.3 (Anaconda 3)?

Thanks

The file 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'])]
    )

Solution:

I found that the line 404 of the file cygwinccompiler.py of the package disutils

out_string = check_output(['gcc', '-dumpmachine'])

has to be changed as

out_string = check_output(['gcc', '-dumpmachine'], shell=True)

Then, it compiles normally.


回答1:


The line 404 of the file cygwinccompiler.py of the package disutils

out_string = check_output(['gcc', '-dumpmachine'])

has to be changed as

out_string = check_output(['gcc', '-dumpmachine'], shell=True)

Then, it compiles normally.



来源:https://stackoverflow.com/questions/24291506/building-minimal-cython-file-with-python-3-3-anaconda-under-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!