2013-07-01 50 views
1

当我尝试在MacOSX 10.7.5上安装lxml并使用Homebrew和pip时,遇到很多问题。我有安装了命令行工具的Xcode 4.6.3。这里是我的具体步骤:在MacOSX 10.7.5上安装lxml时出现错误:

$ export CC=llvm-gcc-4.2 
$ export CXX=llvm-g++-4.2 
$ brew install --use--llvm libxml2 
$ brew install --use-llvm libxslt 
$ sudo pip install lxml 

冲泡安装成功完成,但PIP安装使我有以下错误:

error: command 'cc' failed with exit status 1 

完整的日志是在这里:https://gist.github.com/sloria/5902993

当我尝试使用easy_install:

$ sudo easy_install lxml 

我得到一个不同的错误:

error: Setup script exited with error: command 'cc' failed with exit status 1 

完整的日志在这里:https://gist.github.com/sloria/5903014

这到底是怎么回事?

+0

错误明显是列出:' '的libxml/xmlversion.h' 文件不found' – chrisaycock

回答

0

找到我的解决方案:从Postgres.app的配置脚本混淆了Homebrew。

这只是从我的路径中删除Applications/Postgres.app/Contents/MacOS/bin/的问题。

然后我增加了一个别名psql脚本:alias psql="Applications/Postgres.app/Contents/MacOS/bin/psql"

更多信息从brew doctor

"config" scripts exist outside your system or Homebrew directories. 
`./configure` scripts often look for *-config scripts to determine if 
software packages are installed, and what additional flags to use when 
compiling and linking. 

Having additional scripts in your path can confuse software installed via 
Homebrew if the config script overrides a system or Homebrew provided 
script of the same name. We found the following "config" scripts: 
2

尝试使用系统clang编译器(no --use-llvm标志)并执行brew doctor,因为您不需要使用sudo和pip。访问权限可能存在问题,因此libxml/xmlversion.h可能不可读。 您是否使用brew安装了python/pip?混合酿造和非酿造安装的应用程序有时是一个问题。

我试了一下我的系统(Mac OSX版10.8.4和Xcode的4.6.3)上:

brew install libxml2 
brew install libxslt 
pip install lxml 

,一切都很好。

+0

我尝试过,但我得到了与上面相同的错误(第一个错误)。啤酒医生说 –

+0

一切都好吗? – dlangenk

+0

啊,是的,找到了我的答案,从一个酿造医生的处方。看到我上面的答案。谢谢你的帮助。 –