我已经安装了html5lib软件包。我敢肯定,因为当我尝试安装它时,我收到一条消息,提示它已经安装。

pip install html5lib
Requirement already satisfied: html5lib in ./anaconda/lib/python3.5/site-packages


我也能够成功导入该软件包。

import html5lib


但是,当我尝试将解析器用作BeautifulSoup构造函数的一部分时

soup = BeautifulSoup(response.data, 'html5lib')


我不成功

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


是否可以强制bs4查找已安装的解析器并成功找到html5lib?

最佳答案

采纳了Megalong的建议并重新启动了IDEA。做到了!

10-06 08:40