Problems installing libxml2 on Mac OS X

淺唱寂寞╮ 提交于 2019-12-10 18:46:51

问题


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?


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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


来源:https://stackoverflow.com/questions/3506327/problems-installing-libxml2-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!