KiRaSmile
all right?

修改JupyterNotebook默认工作目录与浏览器

2019-03-12 机器学习
Word count: 305 | Reading time: 1min

1.修改JupyterNotebook默认工作目录


有两个方案

第一个方案:首先WIN+R打开CMD,键入命令

jupyter notebook --generate-config

然后在C:\Users\Administrator\.jupyter中找到文件jupyter_notebook_config.py

打开该文件,ctrl+f搜索NotebookApp.notebook_dir,找到#c.NotebookApp.notebook_dir = ''

将其修改为自己需要的工作目录,如c.NotebookApp.notebook_dir =u'F:\machinelearning\Jupyter Notebook'

(注意将#号删除,不支持中文,可以有空格)

第二个方案:直接进入你需要修改为的工作目录,按住SHIFT然后点击鼠标右键,选择“在此打开PowerShell窗口”

进入PowerShell窗口输入“jupyter notebook”

2.修改JupyterNotebook浏览器(此处修改为Chrome)


打开文件jupyter_notebook_config.py(已在上一步创建)

ctrl+f搜索c.NotebookApp.browser,找到# c.NotebookApp.browser = ''''

在其下方添加

import webbrowser
webbrowser.register("chrome",None,webbrowser.GenericBrowser(u""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe""))   
c.NotebookApp.browser = 'chrome'

(此处括号内地址为你谷歌浏览器.exe文件地址,注意开头不要有空格,命令格式为python格式)

最后需要将快捷方式位置更改,只需要找到快捷方式,右键打开属性,将“目标”中的%USERPROFILE%删除即可

Author: KiRaSmile

Link: http://yoursite.com/2019/03/12/修改JupyterNotebook默认工作目录与浏览器/

Copyright: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.

< PreviousPost
摸鱼!睡觉!一直都是smile哒!
NextPost >
==与===的区别
CATALOG
  1. 1. 1.修改JupyterNotebook默认工作目录
  2. 2. 2.修改JupyterNotebook浏览器(此处修改为Chrome)