简体   繁体   中英

Error when installing lxml on MacOSX 10.7.5:

I am running into many problems when trying to install lxml on MacOSX 10.7.5 with Homebrew and pip. I have Xcode 4.6.3 with the Command-line tools installed. Here are my exact steps:

$ 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

The brew installs finish successfully, but the pip install gives me the following error:

error: command 'cc' failed with exit status 1

Full log is here: https://gist.github.com/sloria/5902993

When I try to use easy_install:

$ sudo easy_install lxml

I get a different error:

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

Full log here: https://gist.github.com/sloria/5903014

What is going on here?

Try using the system clang compiler (no --use-llvm flag) and do a brew doctor because you should not need to use sudo with pip. There might be a problem with the access rights so that libxml/xmlversion.h might not be readable. Did you install python/pip with brew? Mixing brew and not-brew installed applications is sometimes a problem.

I tried it on my system (Mac OSX 10.8.4 and Xcode 4.6.3) with:

brew install libxml2
brew install libxslt
pip install lxml

and everything is fine.

Found my solution: the config scripts from Postgres.app was confusing Homebrew.

It was just a matter of removing Applications/Postgres.app/Contents/MacOS/bin/ from my path.

I then added an alias for the psql script: alias psql="Applications/Postgres.app/Contents/MacOS/bin/psql"

More info from 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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM