无法读取的笔记本:不支持 JSON nbformat 版本 4(支持的版本:3)

Unreadable Notebook: Unsupported JSON nbformat version 4 (supported version: 3)

我刚刚在笔记本电脑上使用 pip 安装了 IPython 3.0,即 运行 Ubuntu 14.04:

$ pip search ipython
ipython-cluster-helper    - Simplify IPython cluster start up and use for
                            multiple schedulers.
ipython                   - IPython: Productive Interactive Computing
  INSTALLED: 3.0.0 (latest)

然而,当我去使用IPython时,终端似乎认为它使用的是1.2.1版本:

$ ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:38) 
Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]

更糟糕的是,当我用 JSON nbformat 版本 4 打开笔记本时,IPython 3.0 支持,我收到以下错误:

Unreadable Notebook: Unsupported JSON nbformat version 4 (supported version: 3)

我尝试使用 IPython 团队推荐的命令将笔记本降级到版本 3,但这对我来说也失败了:

$ ipython nbconvert --to notebook --nbformat 3 1-intro-to-brian-neurons.ipynb 
. . .
[NbConvertApp] CRITICAL | Bad config encountered during initialization:
[NbConvertApp] CRITICAL | Unrecognized flag: '--nbformat'

这是怎么回事?

之前使用 apt-get 安装了旧版本的 IPython。使用 apt-get remove ipython.

删除旧版本

jupyter nbconvert --to notebook --nbformat=3 <file.ipynb> 对我有用。 我本地的 anaconda2 支持版本 4 但 docker 的 ipython 不支持。