JupyterNoteBook修改默认路径以及打开浏览器

1.默认路径的修改

​ 每次在电脑安装Anaconda之后用jupyter notebook都很麻烦,改变默认路径后会很方便之后的存储以及查阅。

默认路径的修改主要分为两步:

1.修改jupyter_notebook_config文件

2.修改jupyter 属性的部分内容

1.1 修改jupyter_notebook_config文件

通过 win+r 打开命令行 输入 jupyter notebook --generate-config

运行命令后会看到jupyter 的配置文件,一般情况下会存在 C盘/user/用户名/.jupyter这个路径下
在这里插入图片描述
对jupyter_notebook_config.py文件进行配置

 ## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ' ' 改为

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'C:\develop\JupyterNoteBook'

在这里插入图片描述

1.2 修改jupyter 属性的部分内容

在开始任务栏中找到Anaconda 3 中的jupyter Notebook,选中点击右键就会看到更多中的打开文件位置。
在这里插入图片描述
jupyter 会看到有个打开文件位置,打开后会看到快捷方式了。之后我们右键—属性会看到下面的页面。
在这里插入图片描述
在这里插入图片描述

起始位置的内容改为本地你设定的路径,如:C:\develop\JupyterNoteBook

目标:%USERPROFILE%/ 改为 起始位置设定的本地路径(C:\develop\JupyterNoteBook)。
在这里插入图片描述
打开jupyter Notebook可以看见默认的存储路径,如下:
在这里插入图片描述

2.设置Jupyter Notebook的默认浏览器为谷歌浏览器

​ 电脑中的浏览器打开Jupyter NoteBook时,一行推荐使用谷歌浏览器,原因就是好用,其他的浏览器(特别是国产浏览器)基本上都是用的谷歌浏览器的底层架构,那我们为什么不用原生态的呢。

​ 在打开Jupyter NoteBook的时候,大家可能会发现打开的浏览器五花八门,有点可能是IE浏览器,有的是360浏览器等等,那建议大家统一更改谷歌浏览器(不然可能会出现一些不兼容的情况)

1.获取Jupyter NoteBook的配置文件(jupyter_notebook_config)

2.更改Jupyter NoteBook打开浏览器的底层代码

2.1 获取配置文件

见1.1的方法

2.2 更改Jupyter NoteBook打开浏览器的底层代码

## Specify what command to use to invoke a web browser when opening the notebook.
#  If not specified, the default browser will be determined by the `webbrowser`
#  standard library module, which allows setting of the BROWSER environment
#  variable to override it.
#c.NotebookApp.browser = ''
import webbrowser
webbrowser.register("chrome",None,webbrowser.GenericBrowser(u"C:\\Users\\hbwhx\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"))
c.NotebookApp.browser = 'chrome'

注: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 为我的google浏览器的文件位置。
在这里插入图片描述
打开jupyter Notebook浏览器切换成功,如下:
在这里插入图片描述

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值