Can the python interpreter tell me where its header files are?

192 Views Asked by At

In debian/CentOS systems, python's excutable, header and library files are organized like:

/usr/(local/|)/bin/python
/usr/(local/|)/include/python-$version$/
/usr/(local/|)/libs

But on Windows, the folder structure is a bit different

C:\\Program\ Files\\Python$version$\\python.exe
C:\\Program\ Files\\Python$version$\\include\
C:\\Program\ Files\\Python$version$\\libs

the sys module can tell me where the executable is in sys.executable and the general folder where all python files are installed in sys.base_prefix, can it or some other module tell me where the header files are?

1

There are 1 best solutions below

0
Catherine Holloway On

This information is available in distutils.sysconfig and sysconfig, i.e.:

prior to python 3.2

from distutils import sysconfig
sysconfig.get_python_inc()

more recent pythons:

import sysconfig
sysconfig.get_config_var("INCLUDEPY")