我已经安装了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?
答案 0 :(得分:1)
取了Megalng的建议并重新启动了IDE。这就行了!