2016-04-05 172 views
4

我试图从PyCharm 2016.1使用jupyter笔记本。我打开以前创建的iPython笔记本,用代码单击单元格,然后运行它。系统会提示您在默认网址处启动jupyter笔记本,然后单击确定。以下是来自“运行”窗口的错误消息:在pycharm中使用jupyter笔记本 - 没有这样的笔记本dir

[C 13:04:23.979 NotebookApp] Bad config encountered during initialization: 
The Jupyter HTML Notebook. 
[C 13:04:23.979 NotebookApp] No such notebook dir: 'C:\\Users\\cb4\\Documents\\python' 

iPython Notebook已在PyCharm中使用默认URL启用。

回答

3

Jupyter将配置信息保存在jupyter_notebook_config.py文件中。您可以在Windows上找到C:\Users\<user>\.jupyter或在Linux上找到~\.jupyter。将c.NotebookApp.notebook_dir条目修改为您保存笔记本的位置。您还可以使用命令行来设置它:

jupyter-notebook --notebook-dir=<path> 

用双引号<path>在Windows上,如果在路径名的空间。

如果在升级到jupyter之前安装了iPython,那么jupyter migration process将使用旧iPython配置文件中的设置。也许你修改iPython已经很长时间了,这就是为什么你从jupyter看到意外启动或运行行为的原因。

此外,该jupyter命令可以帮助解决目录/路径问题:

jupyter --paths 
1

刚刚有同样的问题,并用以下命令解决它:

jupyter notebook --generate-config 

更多的相关信息在这里:http://jupyter-notebook.readthedocs.io/en/stable/config.html

它促使我用默认配置替换当前配置。因此,如果你很好地摆脱了你当前的配置,这是一个简单的选择。