Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 770
paugier Avatar asked Jun 18 '14 17:06

paugier


1 Answers

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.

like image 172
paugier Avatar answered Oct 22 '22 02:10

paugier