jupyter notebook更改默认工作目录

发布时间 2023-05-23 18:46:19作者: hkwJsxl

jupyter notebook默认配置路径:C:\Users\Administrator\.jupyter\jupyter_notebook_config.py

如果找不到配置文件,可以生成一个

jupyter notebook --generate-config

生成配置文件,启动jupyter notebook,会显示配置文件的路径。

image-20230523182824066

打开配置文件jupyter_notebook_config.py,找到c.NotebookApp.notebook_dir配置项,去掉注释,添加指定的目录。

c.NotebookApp.notebook_dir = 'D:\jupyter'

image-20230523182608683

重新启动jupyter notebook,这样无论命令中当前目录是什么,jupyter notebook打开的目录都是指定的