安装好anaconda后默认已经安装了jupyter,但我想在pytorch环境下用,而不是base环境下。 1.在自定义pytorch环境中安装jupyter
conda activate pytorch #从base 进入pytorch 环境
conda install nb_conda #安装包
jupyter notebook #启动jupyter


2.配置jupyter ? 2.1修改默认路径?
???? 生成配置文件 jupyter_notebook_config.py 修改c.NotebookApp.notebook_dir
jupyter notebook --generate-config #生成配置文件
 ?
c.NotebookApp.notebook_dir = 'D:\ProgramData\jupyter_notebook' #修改为自定义路径
?
?
# pytorch命令行进入时homepage路径已修改
jypyter notebook


而从Jupyter Notebook 的快捷方式进入时,默认目录还是原来那个。
2.2修改默认浏览器
?同样打开jupyter_notebook_config.py 查找 c.NotebookApp.browser ?
import webbrowser
webbrowser.register("chrome", None, webbrowser.GenericBrowser(u"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"))
c.NotebookApp.browser = 'chrome'
 修改后重启:

?

?搞定。
?
? ?
|