fedora退出html文件,在Fedora上运行python脚本时没有名为lxml.html的模块

/usr/bin/python report_generation.py

Traceback (most recent call last):

File "report_generation.py", line 9, in ?

import lxml.html

ImportError: No module named lxml.html

做了一些研究,我发现它需要python-lxml包来运行脚本。这台机器已经有一些lxml安装。但是,我无法完成这项工作。

yum search libxml

libxml2.i386 : Library providing XML and HTML support

libxml2.x86_64 : Library providing XML and HTML support

libxml2-devel.i386 : Libraries, includes, etc. to develop XML and HTML applications

libxml2-devel.x86_64 : Libraries, includes, etc. to develop XML and HTML applications

libxml2-python.x86_64 : Python bindings for the libxml2 library

libxslt.i386 : Library providing the Gnome XSLT engine

libxslt.x86_64 : Library providing the Gnome XSLT engine

libxslt-devel.i386 : Libraries, includes, etc. to embed the Gnome XSLT engine

libxslt-devel.x86_64 : Libraries, includes, etc. to embed the Gnome XSLT engine

libxslt-python.x86_64 : Python bindings for the libxslt library

另外,它说,当我试图安装软件包时,它们都是最新的。出于某种原因,它不会在运行脚本时拾取lxml模块并引发此错误。 我是Linux和Python的新手。请提供任何线索来调试此问题。

+1

我猜'的libxml2-python'实际上不是'lxml'可言,但绑定与'libxml2'一起提供。正如[docs](http://www.xmlsoft.org/python.html)所说:“这个发行版包含一组Python绑定,这些绑定将被保证在将来作为库的一部分进行维护......请注意,一些的Python纯粹主义者不喜欢默认的Python绑定集合,而不是抱怨我建议他们看看lxml,更多的python绑定libxml2和libxslt ......“ –

+0

@abarnert我安装的Python版本是2.7.1。当我尝试yum安装python-lxml时,它失败,错误无包python-lxml可用。没事做。有没有其他的选择,我可以安装lxml。 –

+0

不知道你有哪个版本的Fedora以及你已经配置了哪些版本库,我不能告诉你是否有可能让'yum'找到它或你需要做什么。但我的答案有一个rpmfind搜索的链接,它会告诉你确切哪些发行版有这样一个包,并且还告诉你必须通过'pip'来安装它,如果你的发行版没有。这是不是足够的信息? –

你可能感兴趣的:(fedora退出html文件)