Xcode4 Mac OS X(10.7.3)上的pip安装readline失败

Xcode4 Mac OS X(10.7.3)上的pip安装readline失败,xcode4,osx-lion,python-2.7,pip,readline,Xcode4,Osx Lion,Python 2.7,Pip,Readline,通过pip install readline安装readline时,在构建readline的c扩展时,我收到如下错误消息:- Beginning configuration for readline-6.2 for i386-apple-darwin11.3.0 checking whether make sets $(MAKE)... yes checking for gcc... gcc checking for C compiler default output file nam

通过
pip install readline
安装readline时,在构建readline的c扩展时,我收到如下错误消息:-

Beginning configuration for readline-6.2 for i386-apple-darwin11.3.0



checking whether make sets $(MAKE)... yes

checking for gcc... gcc

checking for C compiler default output file name...

configure: error: in `/Users/calvin/.virtualenvs/myproj/build/readline/rl/readline-lib':

configure: error: C compiler cannot create executables

See `config.log' for more details.





============ Building the readline library ============





============ Building the readline extension module ============



running install

running build

running build_ext

building 'readline' extension

Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.7.sdk
在我的系统上搜索MacOSX10.7.sdk的位置会显示:-

calvin$ sudo find / -name "MacOSX10.7.sdk"
Password:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
这不是readline编译所期望的

pip如何定位MacOSX10.7.sdk是否存在缺陷

如何在不将MacOSX10.7复制到
/Developer/SDKs
目录的情况下解决此问题

澄清

这就是我暂时解决问题的方法

calvin$ sudo mkdir -p /Developer/SDKs/
Password:

calvin$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk /Developer/SDKs/MacOSX10.7.sdk

calvin$ pip install readline

但我不太确定这是否是解决问题的“适当”方法,因为可能存在一些固有问题,可能是因为pip应该如何定位我的.sdk位置,或者我在系统路径中遗漏了一些内容。因此,任何关于如何以“适当”方式解决此问题的建议都将不胜感激

这是个好问题。需要注意的是,我在
/Developer/SDKs
中确实有一个
MacOSX10.7.sdk
文件夹,所以可能是文件系统的状态不对

最安全的方法可能是安装XCode,但这在时间上非常昂贵。我将首先创建一个软链接:

sudo ln-s/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/SDKs/MacOSX10.7.sdk


看看这是否奏效。

是的。这正是我解决问题的方法。所以现在我想知道我在安装Xcode时做错了什么。。。这不应该是这样的,因为我能够从Xcode编译我的iphone应用程序,没有任何问题……啊哈。这似乎是因为我使用的是最新版本的Xcode,它已经移动了MacOSX10.7.sdk的位置!参考链接,指向其他开发人员在构建库时遇到的相同问题,并正在寻求端口维护人员的澄清,以更改/更新sdk位置。它将在Python的下一版本中得到修复:实现这一点的另一种方法是安装XCode的命令行工具