gpt4 book ai didi

beautifulsoup - 导入错误 : cannot import name 'HTMLAwareEntitySubstitution'

转载 作者:行者123 更新时间:2023-12-03 20:45:37 27 4
gpt4 key购买 nike

我只是设置了 beautifulsoup4-4.1.0 并将 pip 升级到版本 9.0.1。
当我写这个时:

from bs4 import BeautifulSoup

发生错误:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
from bs4 import BeautifulSoup
File "D:\Program Files (x86)\Python35-32\lib\site-packages\bs4\__init__.py", line 35, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "D:\Program Files (x86)\Python35-32\lib\site-packages\bs4\builder\__init__.py", line 7, in <module>
from bs4.element import (
ImportError: cannot import name 'HTMLAwareEntitySubstitution'

我该怎么办?非常感谢。

最佳答案

在您拥有的版本中,似乎有 might be an errorbs4/builder/__init__.py .

这条线,from .. import _htmlparser应该是:from . import _htmlparser
但是,我建议使用当前版本的 pip 重新安装该软件包。在你离开人迹罕至的道路并尝试编辑源代码之前。

重新安装:pip install --upgrade --force-reinstall beautifulsoup4

关于beautifulsoup - 导入错误 : cannot import name 'HTMLAwareEntitySubstitution' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40856104/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com