【问题标题】:How to fix the "Module not found" issue when it is already installed?如何解决已安装的“未找到模块”问题?
【发布时间】:2019-10-24 02:02:34
【问题描述】:

我尝试导入 BeautifulSoup,但它确实告诉我找不到该模块。我使用 Python 3.7.3 和 Atom 编辑器

但是已经安装了

Requirement already satisfied: BeautifulSoup in C:users\ich\anaconda\lib\site-packages (4,7,1)

Requirement already satisfied: BeautifulSoup in C:users\ich\anaconda\lib\site-packages (from BeautifulSoup4) (1.8)

由于我对编程完全陌生,我不知道如何解决它。设置环境变量?或者将 .atom 文件放入 my_env ?如何激活已安装的软件包(当 import ... 不起作用时?)

我应该把路径 C:users\ich\anaconda\lib\site-packages (4,7,1) 放到 .atom 文件中吗?

【问题讨论】:

  • 在cmd中运行py -0
  • 找不到命令“py”
  • python -m pip install bs4
  • 所以它说它成功构建了bs4。但是,当我尝试在 atom 中运行它时,它仍然说“找不到模块”。 中的文件 C:\Program Files\.atom\Neuer Ordner\test2.py from bs4 import beautifulSoup - 没有名为 bs4 的模块
  • 你有anaconda和python吗?重新打开 Atom 编辑器

标签: python python-3.x beautifulsoup path anaconda


【解决方案1】:

您必须确保 Python 解释器在您的 conda 环境中运行。 在命令行上,您可以通过以下方式实现:

conda activate base
python

我希望其他人可以分享如何使用 Atom 编辑器做到这一点。

【讨论】:

  • "I hope somebody else can share how to do that with the Atom editor" 我一定会把我最后一块披萨送给这样做的人
猜你喜欢
  • 1970-01-01
  • 2019-04-08
  • 2012-03-05
  • 2020-12-25
  • 1970-01-01
  • 2021-08-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多