尝试使用 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
这是怎么回事?
最佳答案
尝试使用系统 clang 编译器(无 --use-llvm 标志)并执行 brew doctor
因为您不需要将 sudo 与 pip 一起使用。访问权限可能存在问题,因此 libxml/xmlversion.h 可能无法读取。
你用brew安装了python/pip吗?混合安装brew和未brew安装的应用程序有时会出现问题。
我在我的系统(Mac OSX 10.8.4 和 Xcode 4.6.3)上尝试过:
brew install libxml2
brew install libxslt
pip install lxml
一切都很好。
关于python - 在 MacOSX 10.7.5 上安装 lxml 时出错 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17410664/