1、配置jupyterlab和jupyternotebook的默認工作路徑。
2、不廢話,直接上步驟
在Jupyter Notebook或者cmd命令行中輸入:
jupyter notebook --generate-config
jupyter-lab --generate-config
生成配置文件“jupyter_notebook_config.py"和jupyter_lab_config.py,生成的文件路徑在用戶目錄下的.jupyter目錄中,生成配置文件的時候會給出路徑,如下:
3、修改參數
用記事本打開這兩個文件編輯,分別找到下面下面參數,在單引號中輸出自己想修改的默認工作路徑,然后保存文件。
jupyter_notebook_config.py
# c.NotebookApp.notebook_dir = 'D:\\Peject\\notebook'
jupyter_lab_config.py
# c.ServerApp.root_dir = 'D:\\Peject\\jupyterLab'
注意:這里的路徑需要雙斜線,入股單斜線會識別不出來,也可以選擇使用"/"。
注意:如果設置了c.ServerApp.root_dir 路徑,則c.NotebookApp.notebook_dir這個參數會失效,具體原因不知道,我說的是現象。
好了,以上就是我摸索出來的修改方法了,希望對大家有幫助。