【问题标题】:module not found error: mybinder interactive notebooks未找到模块错误:mybinder 交互式笔记本
【发布时间】:2021-01-04 20:52:30
【问题描述】:

我正在尝试使用 mybinder.org 创建一个交互式笔记本。这些是我正在采取的步骤:

第一步:将notebook上传到githubgithub link to the simplistic notebook

第 2 步:使用 pip freeze > requirement.txt 创建一个 environment.txt 文件并将其上传到同一个 repo 中。 link to the requirement.txt file

第 3 步:在 mybinder.org 上渲染 notebook。 link to the rendered notebook

笔记本加载后,无法导入任何 numpy 或 pandas 库。我得到 ModuleNotFoundError: No module named 'numpy.这是错误的图像:

我做错了什么?任何提示都非常感谢;我已经研究了一段时间......如果它有帮助,我会使用 JupyterLab 准备我的笔记本。

【问题讨论】:

  • 在菜单中点击 kernel > change kernel 并选择你想要使用的虚拟环境。
  • 你能发布这个import sys; print(sys.executable); print(sys.version); print(sys.version_info) 的输出吗?这是您要使用的正确 python 版本吗?
  • @JayPatel:当然。这是输出:C:\Users\myusername\Anaconda3\python.exe 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
  • @Walid:感谢您的评论。那并没有解决问题。 Kernel 下没有 virtual env 选项。

标签: python github conda jupyter-lab


【解决方案1】:

这里的语法真的很重要。您尝试制作的配置文件应命名为requirements.txt,以便 Binder 识别。 Yours is named incorrectly requirement.txt.

将来,您可以通过转到相关示例'Python environment with a requirements.txt' here 并按下屏幕右上角的绿色Use this template 此处按钮来更轻松地开始回购。同样,您也可以使用all the other examples 作为模板。这些示例的目的和作用在here 上进行了扩展。

【讨论】:

    猜你喜欢
    • 2020-10-12
    • 2021-08-27
    • 2016-08-14
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 2016-05-12
    • 2015-01-11
    • 2016-07-04
    相关资源
    最近更新 更多