Building minimal cython file with python 3.3 (Anac

2019-02-09 20:57发布

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条回答
再贱就再见
2楼-- · 2019-02-09 21:12

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.

查看更多
登录 后发表回答