在Fedora上运行python脚本时没有名为lxml.html的模块

我正在尝试在Fedora Server上运行python脚本.我收到以下错误.

/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的新手.请为我提供调试此问题的任何线索.

解决方法:

sudo yum install python-lxml 

要么

sudo apt-get install python-lxml
上一篇:python – 获取lxml中特定名称的所有节点?


下一篇:使用python请求登录网站