如何更改 Jupyter 启动文件夹 [英] How to change the Jupyter start-up folder
问题描述
我尝试按照 Jupyter Notebook 文档.
不幸的是,我一直无法弄清楚.这个开始于"字段究竟在哪里?
Unfortunately, I haven't been able to figure it out. Where exactly is this "start in" field?
我有一个 Windows 7(64 位)系统,安装了 Anaconda3(不在 C 驱动器中).我想更改 Jupyter 启动文件夹位置.
I've a windows 7 (64 bit) system, with Anaconda3 installed (not in C drive). I want to change Jupyter start folder location.
推荐答案
Jupyter Notebook 和 JupyterLab <;3.0
对于使用 notebook
包安装的旧 Jupyter Notebook 界面并作为 jupyter notebook
运行(有关使用 nbclassic
安装的相同界面,请参阅下一节并使用 jupyter nbclassic
和 JupyterLab 运行):
Jupyter Notebook and JupyterLab < 3.0
For old Jupyter Notebook interface installed with notebook
package and run as jupyter notebook
(see the next section for the identical interface installed with nbclassic
and run with jupyter nbclassic
, and for JupyterLab):
打开
cmd
(或Anaconda Prompt)并运行jupyter notebook --generate-config
.
这会将文件写入 C:Usersusername.jupyterjupyter_notebook_config.py
.
浏览到文件位置并在编辑器中打开它
Browse to the file location and open it in an Editor
在文件中搜索以下行:#c.NotebookApp.notebook_dir = ''
替换为 c.NotebookApp.notebook_dir = '/the/path/to/home/folder/'
确保在路径中使用正斜杠,并使用/home/user/而不是 ~/作为主目录,如果放在双引号中,即使文件夹名称包含空格,也可以使用反斜杠:D:yourUserNameAny FolderMore Folders"
Make sure you use forward slashes in your path and use /home/user/ instead of ~/ for your home directory, backslashes could be used if placed in double quotes even if folder name contains spaces as such :
"D:yourUserNameAny FolderMore Folders"
去掉行首的#
,允许该行执行
Remove the #
at the beginning of the line to allow the line to execute
JupyterLab >= 3、Jupyter Notebook Classic 和 RetroLab
对于最近的 nbclassic
和 JupyterLab >= 3 使用 c.ServerApp.root_dir
而不是 c.NotebookApp.notebook_dir
(和 jupyter server --generate-config
而不是 jupyter notebook --generate-config
).
JupyterLab >= 3, Jupyter Notebook Classic, and RetroLab
For recent nbclassic
and JupyterLab >= 3 use c.ServerApp.root_dir
instead of c.NotebookApp.notebook_dir
(and jupyter server --generate-config
instead of jupyter notebook --generate-config
).
有关上下文,请参阅迁移指南和这个问题关于server
和notebook
之间的区别.
For context see migration guide and this question on differences between server
and notebook
.
这篇关于如何更改 Jupyter 启动文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!