python报错bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml.

小白成长记
**爬虫时遇到的问题1

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

Windows7下的python3.6.5,运行:

soup=BeautifulSoup(content,'lxml')

出现以下错误:
bs4.FeatureNotFound: Couldn’t find a tree builder with the features you requested: lxml. Do you need to install a parser library?
原因:没有解析库安装包

方法1:将参数lxml修改为html.parser

soup=BeautifulSoup(content,'html.parser')

方法2:下载lxml-3.7.3-cp36-cp36m-win_amd64.whl
在cmd上pip install lxml-3.7.3-cp36-cp36m-win_amd64.whl
看到successfully就成功了,这个方法参考知乎https://www.zhihu.com/question/49221958的KyleElliott
下载地址:https://pypi.org/project/lxml/3.7.3/#files

你可能感兴趣的:(python,爬虫)