Skip to content Skip to sidebar Skip to footer

What Did Apple Do To The Python Framework?

[tl;dr? see bottom] Python on OS X has always been somewhat of an abomination in that it's split up and spread out all across the system. Some in /usr, some in /Library/Python, som

Solution 1:

Python.h and other headers are included with Xcode. On my system, it's located in both /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h and /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h. The latter appears to be installed by the Xcode installer.


Solution 2:

Actually, it doesn't look like you understand the OS X ecosystem at all. /System/Library is for Apple-shipped components of the OS X "distribution"; third parties must not put files in there, but should use /Library instead. That's why the built-in Pythons (multiple versions) are in /System/Library/Frameworks/Python.framework, but place the site-packages directories in /Library/Python, so that third-party modules can be installed there. As for /usr/bin, it contains symlinks to the python executable by version, and programs that autoselect the version based on some parameters (see man python). It's actually quite logical and tidy.

Now to answer your questions. C headers and other developer resources are not included in the default install of OS X. This is not specific to Python, and was done to save space on a default install. To get the developer resources, you need to install the developer tools. What were you going to do with a C header without a C compiler, anyway?


Solution 3:

I have encountered similar problems in the past. Space_C0wb0y's suggestion works for me, and using python_select I can switch between "default" versions of python. This also de-couples me from XCode. I've installed versions of 2.6 and 2.7 using MacPorts, which by default places the distribution in locations such as /opt/local/Library/Frameworks/Python.framework/Versions/2.7. It is the only way I have managed to have consistent installations, including 3rd party modules.


Post a Comment for "What Did Apple Do To The Python Framework?"