【问题标题】:JetBrains DataSpell ModuleNotFoundError error when package is installed安装包时 JetBrains DataSpell ModuleNotFoundError 错误
【发布时间】:2021-10-25 10:47:28
【问题描述】:

我使用ipynb-file。当我尝试导入 prophet 库时,我得到了这个:

ModuleNotFoundError: 没有名为“先知”的模块。

但是这个包已经安装并且在我当前的环境中。 Jupyter 服务器的解释器有 prophet 库。当我将光标移动到库名称时,DataSpell 会显示其信息:

如果我在 python 控制台中执行 from prophet import Prophet 一切正常!我认为问题出在 Jupyter 笔记本上,但找不到。

【问题讨论】:

    标签: python pycharm modulenotfounderror prophet dataspell


    【解决方案1】:

    最近遇到了这个问题。 This answer 让我走上正轨。

    jupyter 也安装在我的默认 Ubuntu python 环境之一中,DataSpell 正在使用 that 二进制文件启动服务器,而不是安装在我在 DataSpell 中创建的环境中。

    (巧合的是,该默认环境也安装了诸如 pandas 之类的常用软件包,所以直到我在 DataSpell 管理的环境中安装了一个软件包,没有 已经在我的 Ubuntu 默认 python 环境中。)

    • 我找到了默认的 jupyter 二进制文件:which jupyter
    • 检查脚本:nano /home/<user>/.local/bin/jupyter
    • 看到它安装的python环境:脚本顶部的#!/usr/bin/python3.8
    • 从该环境中卸载jupyterpython3.8 -m pip uninstall jupyter

    然后 DataSpell 使用了正确的 jupyter 二进制文件(并且所有导入工作正常)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-11
      • 2020-10-27
      • 2022-01-03
      • 1970-01-01
      • 1970-01-01
      • 2020-06-17
      相关资源
      最近更新 更多