【发布时间】:2023-03-27 00:10:01
【问题描述】:
我正在尝试运行我的 Python 文件。 (py name.py)
from bs4 import BeautifulSoup as BS
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\bs4\__init__.py", line 29, in <module>
from .builder import builder_registry
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\bs4\builder\__init__.py", line 294, in <module>
from . import _htmlparser
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\bs4\builder\_htmlparser.py", line 7, in <module>
from html.parser import (
ImportError: cannot import name 'HTMLParseError' from 'html.parser' (C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\html\parser.py)
我使用“pip”安装了这个库。 将库完全删除并重新安装后,运行此代码时会出现此错误。
File "name.py", line 9, in <module>
from bs4 import BeautifulSoup as BS
ModuleNotFoundError: No module named 'bs4'
【问题讨论】:
-
试试
pip install -U beautifulsoup4 -
你使用的是哪个python版本?
-
@user3401493 我用的是 3.7.3
-
@Thepersonwiththequestion:相关htmlparseerror-in-python3
-
@stovfl 那里指定的存储库不存在。
标签: python python-3.x beautifulsoup