IPython Notebook错误:加载笔记本时出错

时间:2016-01-23 05:34:24

标签: python python-3.x ipython-notebook jupyter

在过去几分钟内,我无法访问以前使用Python3.4创建的任何.ipynb文件。我带着这些文件进入子目录,输入

ipython3 notebook

当我打开" New"笔记本,我收到以下错误:

Unexpected error while saving file: Untitled1.ipynb database disk image is malformed

我也无法打开旧笔记本。我收到错误:

An unknown error occurred while loading this notebook. This version can load notebook formats v4 or earlier. See the server log for details.

在终端内,它说明了

kernels (twice to skip confirmation).
[E 00:30:22.352 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/traitlets/traitlets.py", line 460, in get
        value = obj._trait_values[self.name]
    KeyError: 'db'

我该如何解决这个问题?

7 个答案:

答案 0 :(得分:8)

搜索nbsignatures.db。它应该在这里:

~/.ipython/profile_default/security/nbsignatures.db

或在这里:

 ~/Library/Jupyter/nbsignatures.db

~代表您的主目录。

将此文件移至临时目录。

重新启动您的IPython Notebook服务器。

答案 1 :(得分:5)

由于我找不到其他答案中提到的任何文件,我找了另一个解决方案,发现这个对我有用:

  

我通过将〜/ .local / share / jupyter目录的所有权从root更改为user来解决了这个问题。

来自https://github.com/ipython/ipython/issues/8997

答案 2 :(得分:3)

删除〜/ .ipython / profile_default / history.sqlite

这对我有帮助。

答案 3 :(得分:2)

这不是每个人的问题,但我收到以下错误消息,因为磁盘实际已满。

An unknown error occurred while loading this notebook. This version can load notebook formats v4 or earlier. See the server log for details.

答案 4 :(得分:2)

就我而言,我的nbsignatures.db在这里,删除后可以正常运行。

~/.local/share/jupyter/nbsignatures.db

记得重启你的 jupyter notebook 服务器。我重新启动了几次才能使其正常工作。

答案 5 :(得分:0)

其他答案对我的情况没有帮助。

最后,我简单地复制了我的笔记本并重命名了副本。 副本没有错误。

答案 6 :(得分:0)

首先在终端中运行以下命令:

sudo jupyter notebook --allow-root

然后某些URL将出现在终端中,例如:

http://localhost:8888/?token=f2704ecba4c88716337f33e79e13335380e25382603afb80

最后,将此URL复制并粘贴到浏览器的新标签中。然后jupyter笔记本将在新选项卡中打开。