[Pythonmac-SIG] Where is Python.h on OS X?

Jack Jansen Jack.Jansen at cwi.nl
Tue Jul 13 22:12:30 CEST 2004


On 11 Jul 2004, at 17:27, Glenn Andreas wrote:
>> For 10.3:
>> /System/Library/Frameworks/Python.framework/Versions/2.3/include/ 
>> python2.3/
>>
>
> It's a bit more subtle than that (especially when using XCode with the  
> various OS SDK's installed).
>
> Normally, from XCode, you can just "add framework", select Python (in  
> /System/Library/Frameworks) and then do #include <Python/Python.h> and  
> everything will work.  That's the easy answer.

But I would advise against this. This is the best solution for the Mac,  
but it has the disadvantage that it uses <Python/Python.h> in stead of  
<Python.h> as on other platforms, which leads to platform  
incompatibilities. Apple also advises against this (but I don't  
remember exactly where, probably in the "porting to OSX"  
documentation).

By far the best solution is to use distutils (as suggested by someone  
else already), the second-best solution is to is -I with a (configure  
generated) path of  
/System/Library/Frameworks/Python.framework/Versions/2.3/include/ 
python2.3 or  
/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman



More information about the Pythonmac-SIG mailing list