【发布时间】:2017-10-24 16:38:08
【问题描述】:
导入 Beautiful Soup 时出现此错误。
from bs4 import BeautifulSoup
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
from bs4 import BeautifulSoup
File "C:\Users\pood1\AppData\Local\Programs\Python\Python36\lib\site-packages\bs4\__init__.py", line 30, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "C:\Users\pood1\AppData\Local\Programs\Python\Python36\lib\site-packages\bs4\builder\__init__.py", line 308, in <module>
from . import _htmlparser
File "C:\Users\pood1\AppData\Local\Programs\Python\Python36\lib\site- packages\bs4\builder\_htmlparser.py", line 7, in <module>
from html.parser import (
ImportError: cannot import name 'HTMLParseError'
Python:3.6.1 , BeautifulSoup:4-4.3.2
我该如何解决这个问题?
【问题讨论】:
-
我解决了这个问题。谢谢你。问题是我的python版本。在我将版本更改为 3.5.3 后,此错误消失了!
-
如果您解决了问题,请将解决方案添加为答案并将其标记为已接受。谢谢。
标签: python-3.x