首页 > 解决方案 > 尝试打开 jupyter 笔记本时出现 nbformat 错误

问题描述

我正在尝试在 macOS Mojave 中安装 Jupyter Notebook。

我已经尝试过使用 Anaconda,但是虽然 anaconda3 显然安装得很好,但在我的 bash 中使用了正确的路径,我得到:

$ jupyter notebook
-bash: jupyter: command not found

我也试过

python3 -m pip install --upgrade pip

python3 -m pip install jupyter

但是在我尝试打开后,jupyter notebook我收到了这个错误:

$ jupyter notebook
Traceback (most recent call last):
  File "/Users/danielavargasrobles/miniconda3/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/Users/danielavargasrobles/miniconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 83, in <module>
    from .services.contents.manager import ContentsManager
  File "/Users/danielavargasrobles/miniconda3/lib/python3.6/site-packages/notebook/services/contents/manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
ModuleNotFoundError: No module named 'nbformat'

有谁知道发生了什么?谢谢!

标签: jupyter

解决方案


您是否在环境中安装了 jupyter ?我有一个类似的问题,jupyter 正在启动,因为安装在 venv 外部但未安装在您的环境中,这将导致 nbformat 问题。

conda activate your_env
conda install jupyter

应该做的伎俩。


推荐阅读