我已经安装了html5lib软件包。我敢肯定,因为当我尝试安装它时,我会收到一条已安装的消息。
pip install html5lib
Requirement already satisfied: html5lib in ./anaconda/lib/python3.5/site-packages
我也能够成功导入该软件包。
import html5lib
但是,当我尝试将解析器作为美丽的构造函数的一部分时
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?
采用了Megalng的建议并重新启动了IDE。那就做到了!