[Pyrex] Installing Pyrex on MacBook with Mac OS X Leopard

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 23 01:22:44 CEST 2008


Raymond Sammut wrote:

> $ python pyrexc myfile.pyx
> 
> /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ 
> Python.app/Contents/MacOS/Python: can't open file 'pyrexc': [Errno 2]  
> No such file or directory

That's not the way you use pyrexc -- it's a shell
command, not a Python module.

There are two currently supported ways of invoking
pyrex:

1) Write a setup.py that imports and uses the distutils
    extension.

2) Write a Makefile that uses the pyrexc command, gcc,
    etc. to do it all the old-fashioned way.

You could also use pyrexc from the shell or a Makefile
to generate the .c files, and then use a normal setup.py
to compile and link them.

The Demos directory contains some example setup.py files
for you to look at.

It's also possible to import the Pyrex compiler from a
Python script and call it directly, but the details
aren't documented yet.

-- 
Greg



More information about the Pyrex mailing list