Python3.7 版本 lxml 模块无法导入 etree 解决思路
问题现状
- Python3.7 版本 lxml 模块无法导入 etree
- 如图所示:


解决方案
-
以下方式我本地无法解决
pythonfrom lxml import html html.etree.HTML()
-
通过安装低版本 lxml 解决
-
原始版本为 4.9.1,后续降级为 4.6.x 依然无法使用
-
通过不断测试,4.5.0版本可正常导入且使用
-
降低版本操作方式:
-
以下方式我本地无法解决
from lxml import html
html.etree.HTML()
通过安装低版本 lxml 解决
原始版本为 4.9.1,后续降级为 4.6.x 依然无法使用
通过不断测试,4.5.0版本可正常导入且使用
降低版本操作方式: