gpt4 book ai didi

python - 导入错误 : no module named html. 解析器

转载 作者:行者123 更新时间:2023-11-28 20:45:25 25 4
gpt4 key购买 nike

Eclipse + python 2.7当我使用 from bs4 import BeautifulSoup 时,发生错误错误列表如下:

Traceback (most recent call last):
File "D:\SDK\SampleTest\FileSearch\src\logic\__init__.py", line 8, in <module>
from bs4 import BeautifulSoup
File "D:\Program Files\Python27\lib\site-packages\bs4\__init__.py", line 29, in <module>
from .builder import builder_registry
File "D:\Program Files\Python27\lib\site-packages\bs4\builder\__init__.py", line 279, in <module>
from . import _htmlparser
File "D:\Program Files\Python27\lib\site-packages\bs4\builder\_htmlparser.py", line 7, in <module>
from html.parser import HTMLParser
ImportError: No module named html.parser

最佳答案

BeautifulSoup文档对此非常清楚:

If you get the ImportError “No module named html.parser”, your problem is that you’re running the Python 3 version of the code under Python 2.

关于python - 导入错误 : no module named html. 解析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23555906/

25 4 0