找不到模块错误:mybinder 交互式笔记本

时间:2021-01-04 20:52:30

标签: python github conda jupyter-lab

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

第一步:在github上传notebook github link to the simplistic notebook

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

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

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

Error message

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

1 个答案:

答案 0 :(得分: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 上进行了扩展。