Dag Sverre Seljebotn wrote:
> Juha Salo wrote:
>> Hi,
>>
>> I've been struggling with this for a day now. I'm trying to get the
>> Primes example from the Cython tutorial to work with Python 3.0.1 on
>> Windows Vista. So far I've managed to produce a primes.pyd file by
>> executing the setup.py file with Python 2.6. The primes module works
>> when I import it in Python 2.6 but importing the module in Python 3.0.1
>> gives me the following:
>>
>> "ImportError: Module use of python26.dll conflicts with this version of
>> Python."
>>
>> I haven't found instructions for using cython with Python 3. The only
>> things I've found are the brief mention of Python 3 support in the
>> cython docs and a forum post explaining that cython modules should be
>> build with Python 3 headers before they can be used with Python 3 but I
>> have no idea how to do it. Could anyone offer me some help with this? If
>> there's a tutorial somewhere on the net, I'd love to hear about it.
>
> You need to execute setup.py using Python 3.0 to build for Python 3.
Heh. Actually, that is likely not possible as the current release of
Cython doesn't run on Python 3 (it will not too far off though).
Anyway, what *should* work is a) executing Cython manually to get a C
file, and b) executing the C compiler manually with the appropriate flags.
You can figure out the flags to pass to the C compiler like this (I'm
not an expert on this and there might be other options to retrieve which
would be slightly more appropriate...)
In [1]: from distutils import sysconfig
In [7]: sysconfig.get_config_var("CFLAGS_FOR_SHARED")
In [8]: sysconfig.get_config_var("CFLAGSFORSHARED")
Out[8]: '-fPIC'
In [9]: sysconfig.get_config_var("CFLAGS")
Out[9]: '-fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes'
In [10]: sysconfig.get_python_inc()
Out[10]: '/usr/include/python2.5'
Your output will be different on Windows.
--
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev