加载 IPython 笔记本时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27588128/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error loading IPython notebook
提问by amaatouq
Once I opened a notebook file with Jupyter (it asks me to convert the file) I never can open it in the standard IPython notebook anymore. I get the following error:
一旦我用 Jupyter 打开了一个笔记本文件(它要求我转换文件),我就再也无法在标准 IPython 笔记本中打开它了。我收到以下错误:
Error loading notebook
Bad Request
2014-12-21 04:13:03.203 [NotebookApp] WARNING | Unreadable Notebook: /FunIT experiment.ipynb global name 'NBFormatError' is not defined
WARNING:tornado.access:400 GET /api/notebooks/FunIT%20experiment.ipynb?_=1419153182928 (::1) 3.11ms referer=http://localhost:8888/notebooks/FunIT%20experiment.ipynb
An example of such corrupted files is this one: https://www.dropbox.com/s/7io99wpoivxmc8f/FunIT%20experiment.ipynb?dl=0
此类损坏文件的一个示例是:https: //www.dropbox.com/s/7io99wpoivxmc8f/FunIT%20experiment.ipynb?dl=0
How can I revert this process? I need to open these files with the standard IPython notebook (v2.2.0).
我怎样才能恢复这个过程?我需要使用标准的 IPython notebook (v2.2.0) 打开这些文件。
采纳答案by maiaini
This problem has to do with incompatibility of the notebook and your IPython version. In my current version of IPython:
这个问题与笔记本和你的 IPython 版本不兼容有关。在我当前的 IPython 版本中:
ipython --version
2.3.1
When I try to open the file (FunIT\ experiment.ipynb):
当我尝试打开文件 (FunIT\experiment.ipynb) 时:
ipython notebook FunIT\ experiment.ipynb
I get the following error message
我收到以下错误消息
Error loading notebook
Unreadable Notebook: FunIT experiment.ipynb Unsupported nbformat version 4
加载笔记本时出错
不可读的笔记本:FunIT Experiment.ipynb Unsupported nbformat version 4
The error message indicates that the notebook format is not supported. Let's install the development version, https://github.com/ipython/ipython. I used virtual Environment, http://docs.python-guide.org/en/latest/dev/virtualenvs/, but it's not necessary.
错误消息表明不支持笔记本格式。让我们安装开发版本,https://github.com/ipython/ipython。我使用了虚拟环境,http://docs.python-guide.org/en/latest/dev/virtualenvs/,但这不是必需的。
Install virtual environment
安装虚拟环境
pip install virtualenv
mkdir test
cd test
virtualenv venv
source venv/bin/activate
Ipython Notebook development installation
ipython Notebook开发安装
git clone --recursive https://github.com/ipython/ipython.git
cd ipython
pip install -e ".[notebook]" --user
Now I have the current development version.
现在我有了当前的开发版本。
ipython --version
3.0.0-dev
And I can open the file with ipython notebook
我可以用 ipython notebook 打开文件
ipython notebook FunIT\ experiment.ipynb
Here is a snippet of the code:
这是代码的一个片段:
import pandas as pd
import numpy as np
from pandas.tools.pivot import pivot_table
#from sklearn.metrics import roc_auc_score
import matplotlib.pyplot as plt
%pylab inline
#from sklearn.neighbors.kde import KernelDensity
import seaborn as sns
import scipy.stats as st
sns.set()
回答by leekaiinthesky
Upgrading IPython fixed it for me:
升级 IPython 为我修复了它:
pip install ipython --upgrade
pip install ipython --upgrade
回答by Sean
This works for me perfectly:
这对我很有效:
pip install jupyter