2012-04-14 130 views
1

当通过pip install readline安装的readline时建立的readline的C扩展,我得到一个错误信息如下: -PIP在Mac OS X上安装的readline(10.7.3)失败

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位置或我很想念我的系统的东西一些固有的问题路径。因此,有关如何解决这种“适当”方式的建议将非常感谢!

回答

2

这是一个很好的问题。作为一个注意点,我/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

,看看如果这样做的伎俩。

+0

是的。这正是我解决我的问题的方法。 所以,现在我想知道我在安装Xcode时做了什么错误...不应该出现这种情况,因为我可以从Xcode编译我的iPhone应用程序,而不会出现任何问题... – 2012-04-14 02:33:42

+0

Aha。这似乎是因为我使用的是最新版本的Xcode,它已经移动了它的MacOSX10.7.sdk位置!参考链接https://trac.macports.org/ticket/33283建设库的其他开发人员遇到同样的问题,并正在寻求港口维护人员更改/更新sdk位置的说明。 – 2012-04-14 02:37:38

+2

它将在Python的下一个发行版中得到修复:http://bugs.python.org/issue14499 – 2012-04-14 04:12:52