Python 3.x 从bs4导入美化组错误

Python 3.x 从bs4导入美化组错误,python-3.x,Python 3.x,我在导入漂亮的汤时出错 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\

我在导入漂亮的汤时出错

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
从bs4导入美化组
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
从bs4导入BeautifulSoup
文件“C:\Users\pood1\AppData\Local\Programs\Python\Python36\lib\site packages\bs4\\uuuuu init\uuuuu.py”,第30行,在
从.builder导入builder_注册表,parserretjectedmarkup
文件“C:\Users\pood1\AppData\Local\Programs\Python\Python36\lib\site packages\bs4\builder\uuuu init\uuuu.py”,第308行,在
从…起导入HTMLPasser
文件“C:\Users\pood1\AppData\Local\Programs\Python\Python36\lib\site-packages\bs4\builder\u htmlparser.py”,第7行,在
从html.parser导入(
ImportError:无法导入名称“HtmlParserError”
Python:3.6.1,BeautifulSoup:4-4.3.2

如何解决此问题?

能否升级到最新版本的Beautiful Soup

pip3 install --upgrade beautifulsoup4

此错误应在最新版本中修复。BeautifulSoup 4.4.0已更新为与python3.5兼容

可能与我解决的此问题相同。谢谢。问题是我的python版本。在我将版本更改为3.5.3后,此错误消失!!如果您解决了此问题,请添加解决方案作为答案并将其标记为a被接受。谢谢。谢谢。我解决了这个问题。非常感谢!!如果我的答案回答了你的问题,你能接受并投票吗?