【问题标题】:I get a 'No module named 'alpha_vantage'' error when i try importing alpha_vantage on Spyder当我尝试在 Spyder 上导入 alpha_vantage 时出现“没有名为 'alpha_vantage' 的模块”错误
【发布时间】:2021-01-27 03:08:20
【问题描述】:

我刚刚使用 pip 安装了 alpha_vantage 并在 IDLE 上尝试了它,但我更习惯于在 Spyder 上工作,所以当我尝试在那里导入它时,我得到了 No module named 'alpha_vantage '

我认为问题在于我使用 pip 而不是 conda,但是当我尝试“conda install alpha_vantage”时,我得到了 PackagesNotFoundError: The following packages are not available from current channels: alpha_vantage

【问题讨论】:

  • 你在哪个环境安装了模块,spyder在哪个环境运行?可能是它安装在与运行 spyder 的环境不同的环境中
  • @Junkrat 我不知道我是否曾经创建过环境。我刚刚安装了 anaconda,然后从 anaconda 导航器安装了 spyder,就是这样

标签: python pip anaconda spyder


【解决方案1】:

我假设当你说你用 pip 安装它时,你的意思是从你的系统默认命令行。 因此,键入以下命令。 (windows cmd)

where python

在 spyder 中做同样的事情。如果没有您的问题,路径输出应该匹配。 (适用于 unix)

which python

【讨论】:

  • 当我使用 where python 命令时我应该找到什么。它显示了 C:\Users\Adam\AppData\Local\Programs\Python\Python37-32\python.exe。我不知道如何对 spyder 完全使用相同的命令
  • 你知道你的 spyder 使用的 shell 吗? Linux、cmd、powershell?
  • 试试“where python”和“which python”看看是否有效。
  • 由于某种原因我没有为 spyder 工作。当我从 C:\Users\Adam> 尝试 where spyder 时,它显示 INFO: 找不到给定模式的文件。
  • 抱歉解释得不够清楚。在 spyder 中尝试“where python”。
【解决方案2】:

首先,要使用 conda,您需要: conda activate 。 要知道 conda env 名称:conda env list 当你留在 env conda 中时:pip install alpha_vantage

【讨论】:

  • 我使用了 conda env list,它只显示了基本环境,我很确定这就是 Spyder 正在使用的
猜你喜欢
  • 2018-11-01
  • 2017-08-24
  • 2019-06-26
  • 2021-11-24
  • 1970-01-01
  • 1970-01-01
  • 2014-12-09
  • 2022-12-07
  • 2021-10-24
相关资源
最近更新 更多