beautifulsoup - 已经获得 BS4 的 html-parser:找不到树生成器 ... html-parser
问题描述
我使用 requirment.txt 在我的项目目录中安装了beautifulsoup4:
requests==2.26.0 beautifulsoup4==4.9.3 html-parser
pip3 install -r requirement.txt --target='local_lib'
尝试导入和运行时出现此错误:
from local_lib.bs4 import BeautifulSoup
soup = Beautifulsoup(html, 'html.parser')
local_lib.bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html-parser. Do you need to install a parser library?
当我尝试从 bs4,而不是 local_lib.bs4 导入时,它可以工作。但是,我只想对模块使用 local_lib 目录。
为什么我的 local_lib 出现此错误,我该如何解决?
解决方案
推荐阅读
- java - 从 Java 中的另一个类返回另一个方法中的用户输入
- rust - 包装返回迭代器的函数时的生命周期问题
- eclipse - CPLEX 在 OS 更新后无法在 MACOS 上工作 (Big Sur)
- python - 如何将文件和文件夹列表转换为给定层次结构中的 json 对象
- c# - 使用 SqlDatabase for .NET,information_schema 在新数据库中不可用,为什么?
- search - 如何在现代搜索中添加精炼器
- r - 如何在 r 环境中调用多个向量以在另一个函数中使用它们
- mysql - 为我提供解决方案,将多个查询组合到一个在 where 条件上几乎没有差异的查询
- javascript - 进入时如何执行函数?
- amazon-web-services - AWS S3 上传失败,ACL public-true