1 分钟修改 Jupyter 启动文件夹
2019-09-26 本文已影响0人
呆鸟的简书

今天重装 Anaconda, 但 Jupyter Notebook 默认文件夹不是平时常用的文件夹,呆鸟对这点很不爽,上网找了几篇文章,貌似它们提供的方法已经失效了,好在后来解决了,现将解决方案分享给大家。
打开 Anaconda Navigator,点击 Environments
,再点击 base(root)
,点击红框里的箭头,选择 Open Terminal
。

输入 jupyter notebook --generate-config
,然后回车。

在 C:\Users\你的用户名\.jupyter
文件夹里生成 jupyter_notebook_config.py
文件。用编辑器打开,搜索 #c.NotebookApp.notebook_dir
。

删掉 #
,去除注释状态,在单引号里填写指定的启动文件夹,如,D:\python
。

保存该文件,重启 Anaconda Navigator,重新打开 Jupyter Notebook。
这时就可以看到 Jupyter Notebook 的启动文件夹已经变啦。

顺便再推荐一个让 Jupyter Notebook 显示多个结果的方法。
使 Jupyter 显示多个输出
正常状态下, Jupyter Notebook 一个单元格只显示一个输出结果,如下图:

运行如下代码以后,一个单元格就可以显示多个输出结果了。
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
a

好了,今天要分享的就是这些。


