pip fails to install packages on moutain loin (Mac OS 10.8.2)

Ned Deily nad at acm.org
Thu Oct 18 18:43:43 EDT 2012


In article 
<53b38fa2-ea8b-4225-bdf3-b9bcbde31743 at o5g2000yqi.googlegroups.com>,
 Peng Yu <pengyu.ut at gmail.com> wrote:

> Hi,
> 
> I installed Python using python-2.7.3-macosx10.6.dmg on my Mac OS
> 10.8.2.
> 
> When try to use pip to install packages, I get the following message.
> Then the installation fails.
> 
> gcc-4.2 not found, using clang instead
> 
> 
> I then create a link from /usr/bin/gcc to gcc-4.2. Then I run pip
> again, I get the following error message.
> 
> Does anybody have a solution to install python on Mac OS 10.8.2 so
> that packages can be installed with pip?
> 
>     /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/exception:
> 42:28: error: bits/c++config.h: No such file or directory
>     In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c+
> +/4.2.1/bits/stl_algobase.h:70,
>                      from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c+
> +/4.2.1/bits/char_traits.h:46,
>                      from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c+
> +/4.2.1/string:47,
>                      from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c+
> +/4.2.1/stdexcept:44,

One issue is that you are mixing compilers and SDKs.  Python 2.7.3 was 
released about the time Apple released Xcode 4.3 which fundamentally 
changed where SDKs are located.  Xcode 4 no longer uses /Developer at 
all, so what is there is likely left behind from 10.7 or earlier 
versions of Xcode.  Further, Xcode 4.5 which is the currently supported 
version on 10.8 does not include an SDK for 10.6.   2.7.3 does have 
support for using clang instead of the Xcode 3.2 gcc-4.2 it was built 
with.  This is untested but the simplest workaround if you are using 
Xcode 4.4 or 4.5.* may be to just remove (or at least rename) /Developer

    sudo mv /Developer /Developer-old

and make sure you have installed the Command Line Tools component of 
Xcode 4.* (Xcode -> Preferences).  If there is no directory at the 
original SDK path (/Developer/SDKs/MacoOSX10.6.sdk), I believe distutils 
will try to build without using an SDK, which may work. Also, you may 
need to define env variable CXX if you are building c++:

    export CXX=/usr/bin/g++
or export CXX=/usr/bin/clang++

The plan is for the next maintenance release of Python 2.7 to work 
better with current Xocde 4.x on 10.7 and 10.7, as the newly released 
Python 3.3.0 does.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list