0. 安装jupyter notebook

1
2
3
4
5
pip install jupyter notebook
#安装插件
pip install jupyter_nbextensions_configurator jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user

安装完成后,extensions里面勾选 “Table of Contents” 以及 “Hinterland”

1. 安装IRkernel

在R中输入

1
2
install.packages('IRkernel')
IRkernel::installspec() # to register the kernel in the current R installation

安装完成后通过cmd控制台输入jupyter notebook,选择新建R就可以了

2. 更改默认打开的文件夹

首先在cmd下使用下面的命令新建和找到配置文件的位置

1
jupyter notebook --generate-config

修改默认打开路径,注意要把前面的注释符号#去掉,然后在引号中加入你想要保存的路径:D:\

img

3. 配置默认启动浏览器

配制默认从chrome启动。

首先查看chrome安装路径:

img

然后在jupyter_notebook_config.py中输入以下内容:

1
2
3
4
5
6
import webbrowser

webbrowser.register('chrome', None, webbrowser.GenericBrowser(u'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'))

c.NotebookApp.browser = 'chrome'

4. 安装jupter notebook的自定义主题

1
pip install --upgrade jupyterthemes

#查看主题名称

jt -l

#选择相应的主题

jt -t chesterish -T -N

更多主题设置可以看这里:https://baijiahao.baidu.com/s?id=1622108825317402337&wfr=spider&for=pc