Question to python C API

Stefan Behnel stefan_ml at behnel.de
Sat Apr 18 03:21:25 EDT 2009


Andreas Otto wrote:
>   just my first step in Cython
> 
>   1. download Cython-0.11.1
> 
>   2. read INSTALL.txt
> 
>>>>>>>>>>>>> <
> (1) Run the setup.py script in this directory
>     as follows:
> 
>         python setup.py install
> 
>     This will install the Pyrex package
>     into your Python system.
> <<<<<<<<<<<<<
> 
>         Question 1: Why you wall it "Pyrex" package ?

That's a left-over. We fixed the name almost everywhere by now, but that
slipped through.

That shows that the installation instructions haven't been touched in years
(although they should work in general).


>   3. this happen
> 
>> python ./setup.py install
> Traceback (most recent call last):
>   File "./setup.py", line 5, in <module>
>     from Cython.Compiler.Version import version
>   File "/home/dev1usr/src/Cython-0.11.1/Cython/__init__.py", line 2, in
> <module>
>     from Shadow import *
> ImportError: No module named Shadow

Relative imports have changed in Py3, so as you write:

>   4. I use a thread enabled python V3 

That's the core problem. :) Like many other Python packages, Cython doesn't
currently run in Py3. You can run it in any Py2 version starting from 2.3,
and the code it generates will run on 2.3 through 3.1a1. But the Cython
compiler itself requires 2.x. This is being fixed up as we speak, and the
2to3 conversion tool works pretty well on the source by now, so there's a
fair chance that Cython 0.12 will run on Py3.

Stefan



More information about the Python-list mailing list