tags:

views:

282

answers:

2

I'm making my first steps with Cython, and I've installed it on my machine according to the instructions in the wiki.

Working through the Cython tutorial I got to pyximport, which is supposed to make cython compilation really simple. When I tried using it, though, I got the following error message (reformatted):

ImportError: Building module failed: 
DistutilsPlatformError('
    Python was built with Visual Studio 2003;
    extensions must be built with a compiler than can generate compatible binaries.
    Visual Studio 2003 was not found on this system. If you have Cygwin installed,
    you can try compiling with MingW32, by passing "-c mingw32" to setup.py.',)

So my question is: anyone know of a way to make pyximport use mingw?

Note that mingw seems to be installed properly, the long way to make Cython modules (using setup.py) did work for me, and that I even created a distutils.cfg file like the wiki told me.

+2  A: 

I was recently mucking around and discovered the setup_args argument of pyximport.install. This works for me:

mingw_setup_args={'options': {'build_ext': {'compiler': 'mingw32'}}}
import pyximport; pyximport.install(setup_args=mingw_setup_args)
MEmmett