1

尝试使用 Homebrew 和 pip 在 MacOSX 10.7.5 上安装 lxml 时遇到很多问题。我有安装了命令行工具的 Xcode 4.6.3。这是我的确切步骤:

$ 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

brew 安装成功完成,但 pip install 给了我以下错误:

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

这里发生了什么?

4

2 回答 2

2

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

我在我的系统(Mac OSX 10.8.4 和 Xcode 4.6.3)上尝试了它:

brew install libxml2
brew install libxslt
pip install lxml

一切都很好。

于 2013-07-01T18:43:40.600 回答
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:
于 2013-07-01T20:22:45.550 回答