Python.h header file missing on Mac OS X 10.6 Python.h header file missing on Mac OS X 10.6 xcode xcode

Python.h header file missing on Mac OS X 10.6


Python is a framework on Mac OS X so you need to,

#include <Python/Python.h>

You also need to call gcc with the -framework argument to actually do anything inside C,

gcc -shared -o sample.so sample.c -framework Python


I'm not sure about 10.6.8, but Python.h should be in

/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

if you installed the official python.org binary. Try adding

-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

to your gcc command and see if that works.


In case you have installed Python using Brew, it may be worthwhile to check the location of where your headers are. Try I/usr/local/Cellar/python/...