簡體   English   中英

安裝beautifulsoup

[英]Installing beautifulsoup

我已經為 Python 安裝了 beautifulsoup,但是當我導入庫時它給了我這個錯誤:

Traceback (most recent call last):
  File "D:/Playroom/WebScraper_01.py", line 2, in <module>
    from bs4 import BeautifulSoup
  File "C:\Python\lib\site-packages\bs4\__init__.py", line 29, in <module>
    from .builder import builder_registry
  File "C:\Python\lib\site-packages\bs4\builder\__init__.py", line 294, in <module>
    from . import _htmlparser
  File "C:\Python\lib\site-packages\bs4\builder\_htmlparser.py", line 7, in <module>
    from html.parser import (
ImportError: cannot import name 'HTMLParseError'

有誰知道為什么?

  • 如果您收到 ImportError “No module named HTMLParser”,則您的問題是您正在 Python 3 下運行 Python 2 版本的代碼。

  • 如果您收到 ImportError “No module named html.parser”,則您的問題是您正在 Python 2 下運行 Python 3 版本的代碼。

請參閱: https : //www.crummy.com/software/BeautifulSoup/bs4/doc/#problems-after-installation

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM