beautifulsoup,html5lib:模块对象没有属性_base

Ehv*_*nce 60 beautifulsoup html5lib

当我更新我的包时,我遇到了这个新错误:

class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'
Run Code Online (Sandbox Code Playgroud)

我尝试更新beautifulsoup,没有更多的结果.我该如何解决这个问题?

Mat*_*ano 107

我升级了beautifulsoup4和html5lib,它解决了这个问题.

pip install --upgrade beautifulsoup4
pip install --upgrade html5lib
Run Code Online (Sandbox Code Playgroud)

  • 确认这有助于让`sudo pip install spry`在没有错误的情况下正常工作2017年2月. (2认同)

小智 26

这是上游包html5lib的一个问题:https://bugs.launchpad.net/beautifulsoup/+bug/1603299 要修复,强制降级到旧版本:

pip install --upgrade html5lib == 1.0b8


Ehv*_*nce 19

编辑新闻,2017年:似乎这不再起作用了

最后发现,一个搜索引擎没有抛出任何东西,但它在beautifulsoup的问题跟踪器上被引用:https://bugs.launchpad.net/beautifulsoup/+bug/1603299

它与html5lib v 0.9999999(7个9)一起工作

"html5lib<=0.9999999"
Run Code Online (Sandbox Code Playgroud)

  • `html5lib <= 0.9999999`有一个安全漏洞,不应再使用了.资料来源:https://www.sourceclear.com/registry/security/cross-site-scripting-xss-/python/sid-3068 (4认同)
  • (在W7上).不幸的是我尝试了降级和升级.我还尝试使用Python 2.7安装虚拟环境.到目前为止没有任何工作,基本上我坚持使用beautifulsoup库 (2认同)

rec*_*for 7

在@Bhavuk中降级到html5lib 1.0b8的答案有效,但课程是漂白的版本问题.

我的解决方案是改变漂白剂的版本,以便与新版本的html5lib兼容

pip install --upgrade bs4
pip install --upgrade bleach==1.4.2
pip install --upgrade html5lib==1.0b8
Run Code Online (Sandbox Code Playgroud)

Python版3.5