【问题标题】:ImportError: No module named bs4 AtomImportError:没有名为 bs4 Atom 的模块
【发布时间】:2021-01-05 18:52:22
【问题描述】:

我正在使用 Atom (1.53.0) 通过 Beautiful Soup 进行网页抓取。

我在该行中收到一条错误消息:

from bs4 import BeautifulSoup

内容如下:

ImportError: No module named bs4

在终端执行以下命令时:

pip install beautifulsoup4

我得到了结果:

Requirement already satisfied: beautifulsoup4 in ./opt/anaconda3/lib/python3.7/site-packages (4.8.2)
Requirement already satisfied: soupsieve>=1.2 in ./opt/anaconda3/lib/python3.7/site-packages (from beautifulsoup4) (1.9.5)

我注意到关闭 atom 并重新打开它可以解决问题。 但是,一直关闭 atom 非常不方便。有没有办法解决这个问题?

一些信息)

Python 版本:3.7.6

MacOs 版本:10.15.5

Atom 版本:1.53.0

提前致谢!

【问题讨论】:

  • 你遇到这个问题的时候虚拟环境激活了吗?

标签: python beautifulsoup atom-editor importerror


【解决方案1】:

错误是找不到bs4 模块,因此请尝试安装bs4 而不是beautifulsoup4

pip install bs4

【讨论】:

    猜你喜欢
    • 2012-07-31
    • 1970-01-01
    • 2014-10-31
    • 2017-06-18
    • 1970-01-01
    • 2017-02-19
    • 2016-02-27
    • 2018-12-30
    • 2015-01-02
    相关资源
    最近更新 更多