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

2022-11-28 15:53:18 浏览数 (1)

问题描述: 代码如下:

代码语言:javascript复制
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:

代码语言:javascript复制
pip install lxml

0 人点赞