[Pyrex] proper way of setting up Pyrex compile environment
Robert Kern
robert.kern at gmail.com
Fri May 18 16:31:06 UTC 2007
Brian Blais wrote:
> Hello,
>
> I have a number of projects where I compile Pyrex extensions which use numpy arrays.
> I am not sure how I should set up my environment to do this. Currently, I copy the
> c_numpy.pxd and the c_python.pxd into the project directory, and then I make a link
> to /usr/local/lib/python2.5/site-packages/numpy/core/include/numpy/ in the project
> directory, to deal with the include files.
>
> Well, it works, but I know this isn't the way it is *supposed* to work. I am
> running in Linux, but am interested in Windows and OS X as well for this question.
> Is there an environment variable that I should set? If I distribute uncompiled code,
> is there a way to have the compile process figure out where the includes and the .pxd
> files are?
Copy the c_numpy.pxd and c_python.pxd files. You'll most likely want to add
functions anyways; those are examples, not the full APIs.
As for compiling with numpy, either use numpy.distutils, which will take care of
everything for you, or import numpy and ask it where its headers are.
include_dirs=[numpy.get_include()],
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Pyrex
mailing list