Pergunta

I'm trying to install libxml2 on my Mac (OS 10.6.4). I'm actually trying to just run a Scrapy script in Python, which has required me to install Twisted, Zope, and now libxml2. I've downloaded the latest version (2.7.7, from xmlsoft.org) and tried following these instructions here. To summarize, I tried this command (in the python subdirectory):

python setup.py --static-deps --libxml2-version=2.7.7 -- libxslt-version=1.1.24

I end up with this error:

failed to find headers for libxml2: update includes_dir

Any ideas?

I also tried running this command:

./configure --with-python=/System/Library/Frameworks/Python.framework/Versions/2.6/

And I get the following error:

configure: error: no acceptable C compiler found in $PATH

Does that shed any light on the situation?

Foi útil?

Solução

I figured out how to get libxml2 installed. It took two steps. First, I didn't have XCode installed, so I had to get that downloaded and installed from Apple Developer Tools. I thought that it had come standard on OX 10.6.4, but I guess not.

Then, in the libxml2 folder I ran these three commands:

./configure --with-python=/System/Library/Frameworks/Python.framework/Versions/2.3/
make
sudo make install

After that, I switched to the Python subdirectory of the libxml2 folder, and ran a generic setup:

python setup.py install

After that, everything was ready to go.

Outras dicas

Shouldn't you write --libxml2-version=2.7.7 instead?

I know this is an old thread, but I just encountered this error while installing dependency with pip.

failed to find headers for libxml2: update includes_dir

I fixed it by reinstall xcode command line tools with

xcode-select --install

Hope this will help other ones who find this thread.

I had the same problem with a virtualenv and solved it adding the path to libxml2 what homebrew just installed in the global site-packages:

echo '/usr/local/opt/libxml2/lib/python2.7/site-packages/'  > /Users/panchicore/.virtualenvs/<virtualenv-name>/lib/python2.7/site-packages/homebrew.pth
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top