2013-07-01 48 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

啊,是的,找到了我的答案,從一個釀造醫生的處方。看到我上面的答案。謝謝你的幫助。 –