Python3.7爬虫报错处理bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: ht

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

使用BeautifulSoup时,把解析器换成lxml就出错
Python3.7爬虫报错处理bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: ht
原因:
缺少lxml库。在cmd命令下输入”pip install lxml“安装即可以。
JetBrains PyCharm IDE中,点击File ->Setting-> Project Interpreter,点击+号
Python3.7爬虫报错处理bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: ht
搜索lxml,点击Install Package,等待一会,提示安装成功
Python3.7爬虫报错处理bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: ht