On 2010-02-22 17:42 PM, T J wrote:
> Hi,
>
> I have numpy installed system-wide, but I also have my own (svn)
> version in ~/.local.  When I compile cython modules which make use of
> the NumPy array access, it needs to reference the NumPy include files.
>   These are located here:
>
>     ~/.local/lib/python2.6/site-packages/numpy/core/include/numpy/
>
> The "problem" I am having is that when I compile the cython extension,
> it is using libraries located here:
>
>    /usr/include/python2.6/numpy
>
> This is inconsistent since when I import numpy, it is definitely using
> the version in ~/.local.   I want to avoid setting INCLUDE_DIRS in my
> .bashrc.  An obvious solution is that I should specify the proper
> include directory when I create the Extension instance in my setup.py.
>   Something like:
>
>    d = os.path.join(os.path.split(numpy.__file__)[0], "core", "include")
>    Extension(... , include_dirs=[d])
>
> Is this the proper/recommended way to handle this?  More to the point,
> it seems like this should be done for the users.  Perhaps
> numpy.distutils.extention.Extension should append the include path for
> NumPy.

Other parts of numpy.distutils handle that. Unfortunately, those are the parts 
that conflict with Cython's distutils extensions. Just use

   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

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to