numpy.get_include#

numpy.get_include()[source]#

Return the directory that contains the NumPy *.h header files.

Extension modules that need to compile against NumPy may need to use this function to locate the appropriate include directory.

Notes

When using setuptools, for example in setup.py:

import numpy as np
...
Extension('extension_name', ...
          include_dirs=[np.get_include()])
...

Note that a CLI tool numpy-config was introduced in NumPy 2.0, using that is likely preferred for build systems other than setuptools:

$ numpy-config --cflags
-I/path/to/site-packages/numpy/_core/include

# Or rely on pkg-config:
$ export PKG_CONFIG_PATH=$(numpy-config --pkgconfigdir)
$ pkg-config --cflags
-I/path/to/site-packages/numpy/_core/include