Use the jupyter notebook config file:
Open cmd
(or Anaconda Prompt) and run jupyter notebook --generate-config
.
This writes a file to C:Usersusername.jupyterjupyter_notebook_config.py
.
Browse to the file location and open it in an Editor
Search for the following line in the file:
#c.NotebookApp.notebook_dir = ''
Replace by c.NotebookApp.notebook_dir = '/the/path/to/home/folder/'
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
2021 update:
For recent nbclassic
and JupyterLab>=3 use c.ServerApp.root_dir
instead of c.NotebookApp.notebook_dir
(and jupyter server --generate-config
instead of notebook).
For context see migration guide and this question on differences between server
and notebook
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…