您当前的位置: 首页 >  Python

Better Bench

暂无认证

  • 2浏览

    0关注

    695博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【Python 3】解决FeatureNotFound: Couldn‘t find a tree builder with the features you requested: lxml.

Better Bench 发布时间:2021-02-02 11:47:18 ,浏览量:2

问题

环境:Python3.6 使用如下代码时

soup = BeautifulSoup(s, “html”)

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

解决办法

因为可能问题不同,有不同的解决办法 (1)第一种可能:根本没有安装lxml

sudo apt-get install libxml2-dev libxslt-dev python-dev
pip install beautifulsoup4
sudo pip install lxml

(2)第二种可能,缺少包libxslt

pip install libxslt

(3)第三种可能:lxml版本与Python3.6不兼容,需要lxml3.7.3版本

pip install lxml==3.7.3

(4)直接不用lxml。使用python自带的lxml

soup = BeautifulSoup(s, “html.parser”)
关注
打赏
1665674626
查看更多评论
立即登录/注册

微信扫码登录

0.0893s