修改jupyter lab/jupyter notebook默认打开文件夹和浏览器及创建jupyter lab的快捷方式

一、如何修改打开的文件夹和浏览器:

1、用记事本打开C:\Users\Tom\.jupyter\jupyter_notebook_config.py

2、查找## The directory to use for notebooks and kernels.修改为:

## The directory to use for notebooks and kernels.

c.NotebookApp.notebook_dir = 'E:\数据恢复\教程\PYTHON'

3、查找#c.NotebookApp.browser = ''并且换行之后再增加四行代码:

#c.NotebookApp.browser = ''

import webbrowser

webbrowser.register("msedge",None,webbrowser.GenericBrowser(u"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe"))

c.NotebookApp.browser = 'msedge'

4、最终生效还要修改快捷方式的目标:删除最后的"%USERPROFILE%/",否则只能更改浏览器,打开文件夹仍为C:\Users\Tom

以下为jupyter notebook修改前后的快捷方式的目标:

D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\cwp.py D:\Anaconda3_2019.03 D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\Scripts\jupyter-notebook-script.py "%USERPROFILE%/"

D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\cwp.py D:\Anaconda3_2019.03 D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\Scripts\jupyter-notebook-script.py

以下为jupyter lab修改前后的快捷方式的目标:

D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\cwp.py D:\Anaconda3_2019.03 D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\Scripts\jupyter-lab-script.py "%USERPROFILE%/"

D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\cwp.py D:\Anaconda3_2019.03 D:\Anaconda3_2019.03\python.exe D:\Anaconda3_2019.03\Scripts\jupyter-lab-script.py

二、安装anaconda后,jupyter lab本来没有快捷方式,可以根据jupyter notebook的快捷方式自己做一个。

1、对比上面的快捷方式目标可以看出,修改一处即可做出jupyter lab的快捷方式:

将D:\Anaconda3_2019.03\Scripts\jupyter-notebook-script.py修改成D:\Anaconda3_2019.03\Scripts\jupyter-lab-script.py即可。(jupyter-lab-script.py这个文件在对应路径的文件夹中可以找到)

2、将jupyter notebook的快捷方式的副本进行修改,更改名称和目标即可。

© 著作权归作者所有,转载或内容合作请联系作者

推荐阅读 更多精彩内容