导入BeautifulSoup: from bs4 import BeautifulSoup

报错信息:

class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: ‘module’ object has no attribute ‘_base’

解决方法:

在终端中安装指定版本的html5lib:pip install --upgrade html5lib==1.0b8

安装后报错信息解决。