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. Details: The C file generated by Cython is the same for all Python versions, however it must be compiled with a different include path for the Python headers depending on the Python version. Executing setup.py with the right Python version takes care of this automatically. You can see this by Py3> from distutils import sysconfig Py3> sysconfig.get_python_inc() '/home/dagss/opt/python3.0/include/python3.0' which should be passed as an include path to the C compiler. Feel free to add this to the wiki in a place you would have found it if you get it to work. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
