FeatureNotFound( bs4.FeatureNotFound: Couldn‘t find a tree builder with the features you requested:

问题描述:
代码如下:

from bs4 import BeautifulSoup

# 在此实现代码
def fetch_text(html):
    soup = BeautifulSoup(html, 'lxml')
    result = soup.text
    return result

执行到这行:BeautifulSoup(html, ‘lxml’),报如下错误:
in init
raise FeatureNotFound(
bs4.FeatureNotFound: Couldn’t find a tree builder with the features you requested: lxml. Do you need to install a parser library?

执行如下命令,下载安装lxml:

pip install lxml

猜你喜欢

转载自blog.csdn.net/qq_35427589/article/details/126135858