修改Jupyter Notebook文件默认保存路径

1. 生成默认配置文件

运行cmd, 执行 jupyter notebook --generate-config

C:\Users\John Zhang>jupyter notebook --generate-config
Writing default config to: C:\Users\John Zhang\.jupyter\jupyter_notebook_config.py

会提示默认配置文件路径

2. 编辑配置文件

将 C:\Users\John Zhang.jupyter\jupyter_notebook_config.py 中:

## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''

去掉注释,并修该为相应目标路径(路径必须存在)

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'F:\\AI\jupyterNotebook'

3. 重启Jupyter Notebook

发现路径变为修改后的路径。

打印当前路径:

import os
print(os.path.abspath('.'))

打印当前默认路径

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章