本地电脑远程使用服务器 jupyter notebook及主题更换
前言
本篇介绍如何在本地电脑远程使用服务器上的jupyter notebook,并且介绍如何更换jupyter notebook 的主题,使其看起来更漂亮。
一、本地电脑远程使用服务器上的jupyter notebook
本地电脑Windows系统,服务器Linux系统。 在服务器上下载安装annconda后,进行如下配置jupyter notebook.
-
建立config文件
jupyter notebook --generate-config
-
进入.jupyter文件夹
cd ~/.jupyter
-
打开 jupyter_notebook_config.py文件
vim jupyter_notebook_config.py
-
修改jupyter_notebook_config.py文件,添加如下命令
#获取配置
c = get_config()
#设置为 * 表示所有 IP 都可以访问c.NotebookApp.ip = '*'
#禁止Notebook 启动时自动打开浏览器c.NotebookApp.open_browser = False
#指定访问的端口,默认是8888,自己设置一个即可c.NotebookApp.port = 6006
#全0表示接受任何IP地址的访问c.ConnectionFileMixin.ip = '0.0.0.0'
#允许远程访问c.NotebookApp.allow_remote_access = True
-
尝试打开jupyter notebook
jupyter notebook --ip=*.*.*.*
此处ip为所访问服务器的ip.
-
本地打开
将上一步copy and paste one of these URLs下的链接复制到本地浏览器中。
二、jupyter notebook 更换主题
- 安装主题包
pip install jupyterthemes
- 升级主题包(可选可不选)
pip install --upgrade jupyterthemes
- 更换 Jupyter 主题
jt -t onedork -f fira -fs 13 -cellw 60% -ofs 11 -dfs 11 -T -N
-t 主题 -f(字体) -fs(字体大小) -cellw(占屏比或宽度) -ofs(输出段的字号) -T(显示工具栏) -N(显示名称) - 查看可用的 Jupyter 主题:
jt -l
- 恢复Jupyter 默认风格:
jt -r
注:
-
juputer notebook主题github地址https://github.com/dunovank/jupyter-themes,介绍非常详细,可以好好看看,下面给出一个命令选项的翻译,供参考。
-
我的配置:
jt -t monokai -f fira -T -N
总结
本篇介绍如何在本地电脑远程使用服务器上的jupyter notebook,并且介绍如何更换jupyter notebook 的主题,使其看起来更漂亮。不同的有不同的喜好风格,既然知道了怎么更换主题,就赶紧试试,找到自己中意的那种。。。