[Numpy-discussion] arrayobject.h (and friends) install location

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Jan 17 10:27:12 CST 2006


On 1/17/06, Andrew Straw <strawman at astraw.com> wrote:
> ...
> Also, as for as I know, the only packages that install things into
> /usr/include/python2.x/packagename are Numeric and numarray, so I would
> argue it's not "standard", (although it may have lots of history).

I don't know what would qualify as "standard", but Numeric's header
location is specifically mentioned in the distutils manual:
"""
If you need to include header files from some other Python extension,
you can take advantage of the fact that header files are installed in
a consistent way by the Distutils install_header command. For example,
the Numerical Python header files are installed (on a standard Unix
installation) to /usr/local/include/python1.5/Numerical. (The exact
location will differ according to your platform and Python
installation.) Since the Python include
directory--/usr/local/include/python1.5 in this case--is always
included in the search path when building Python extensions, the best
approach is to write C code like

#include <Numerical/arrayobject.h>
"""

(see http://docs.python.org/dist/describing-extensions.html#SECTION002320000000000000000)

The same section also criticises the idea of specifying include path
explicitely:
"""
If you must put the Numerical include directory right into your header
search path, though, you can find that directory using the Distutils
distutils.sysconfig module:

from distutils.sysconfig import get_python_inc
incdir = os.path.join(get_python_inc(plat_specific=1), 'Numerical')
setup(...,
      Extension(..., include_dirs=[incdir]),
      )

Even though this is quite portable--it will work on any Python
installation, regardless of platform--it's probably easier to just
write your C code in the sensible way.
"""


-- sasha




More information about the Numpy-discussion mailing list