BLOG
Enjoy when you can, and endure when you must.
JUN 26, 2014/Python
Ubuntu安装lxml的小插曲

今天需要用BeautifulSoup来解析xml,于是很自然地想到了在实例化时加入features='xml'参数。不过收到了如下错误:

FeatureNotFound: Couldn't find a tree builder with the features you requested: xml. Do you need to install a parser library?

很明显,没有安装lxml,不过利用pip安装时遇到如下错误:

In file included from src/lxml/lxml.etree.c:346:0:

/home/danny/build/lxml/src/lxml/includes/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory

compilation terminated.

看来还有连带的东西啊,apt安装:

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

接下来再次安装lxml即可。

COMMENTS
LEAVE COMMNT