当python2.x导入bs4时候出现如下的莫名其妙的错误:
Traceback (most recent call last):
File “xxxxxx.py”, line x, in <module>
from bs4 import BeautifulSoup
File “build\bdist.win-amd64\egg\bs4\__init__.py”, line 30, in <module>
File “build\bdist.win-amd64\egg\bs4\builder\__init__.py”, line 314, in <module>
File “build\bdist.win-amd64\egg\bs4\builder\_html5lib.py”, line 70, in <module>
AttributeError: ‘module’ object has no attribute ‘_base’
而bs4已经安装成功了,那问题会出在哪里?
经过多方查证,竟然是html5lib
包的问题,进入html5lib\treebuilders
下的base.py
更改为_base.py
并把base.pyc
删除,就可以完美解决该问题。