ubuntu 下安装 lxml 失败

/tmp/pip-build-7HN4t8/lxml/src/lxml/includes/etree_defs.h:14:31: fatal error: libxml/xmlversion.h: No such file or directory

/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-7HN4t8/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace(' ', ' '), __file__, 'exec'))" install --record /tmp/pip-LUVnYB-record/install-record.txt --single-version-externally-managed --compile --install-headers /root/pycode/blogenv/include/site/python2.7/lxml" failed with error code 1 in /tmp/pip-build-7HN4t8/lxml

看了下安装文档

apt-get install libxml2-dev libxslt-dev python-dev

然后再次

pip install lxml

就成功了。

原文地址:https://www.cnblogs.com/tk091/p/4440545.html