[Pythonmac-SIG] locating Python.h
skip at pobox.com
skip at pobox.com
Fri Apr 4 15:48:08 CEST 2008
Feat> I've carefully read the section about building extensions, ...
Feat> but this doesn't tell me how to locate the right Python header
Feat> file...
Distutils takes care of that for you. All you should need to do is
#include "Python.h"
in your source. As you concluded, the correct one to use is the one which
corresponds to the Python executable you're using. I believe distutils uses
sys.exec_prefix and the version of the running Pyhon to get a base directory
for the installation. From there it's just a hop, skip and jump to the
installed Include directory which corresponds to that running executable.
For example, for my current python, 2.6, I installed it in ~/local. That
gives me an include file directory of ~/local/include/python2.6.
--
Skip Montanaro - skip at pobox.com - http://www.webfast.com/~skip/
More information about the Pythonmac-SIG
mailing list