首先需要生成配置文件
PS C:\Windows\system32> jupyter lab --generate-config
Writing default config to: C:\Users\xiyu\.jupyter\jupyter_notebook_config.py
實際上,jupyter notebook 生成的配置文件也是相同。
jupyter notebook --generate-config
然後修改配置文件
去除註釋,並將其改爲需要的路徑
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'D:\\notebook\\'
注意:notebook這個文件夾要首先創建好!!
但是,如果使用Jupyter Notebook (anaconda)這個快捷方式打開,則不會讀取配置文件。
需要刪除,快捷方式目標中的 “%USERPROFILE%” ,其的意思是使用用戶的根目錄作爲jupyter的根目錄。