美文网首页python
jupyter notebook使用帮助

jupyter notebook使用帮助

作者: mmmwhy | 来源:发表于2017-01-12 20:52 被阅读8711次

jupyer notebook 使用的时候常见换主题,以及换工作空间的问题。更多见:iii.run

jupyter notebook 换字体换颜色换主题

jupyter notebook自带的默认颜色实在是太阳春白雪,看的多了眼睛有点累。页面的相关定义都是在CSS内完成的,我们可以通过修改CSS来达到目标。
但是这样实在是太累了,在GIthub有一个jupyter-themes工具,真的很好用,通过pip进行安装,分分钟更换成自己喜欢的主题。

安装 jupyterthemes

pip install jupyterthemes
通过pip安装省时省力,如果你当前pip安装速度很慢,可以考虑使用清华源,代码如下:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyterthemes

命令行格式

usage: jt [-h] [-l] [-t THEME] [-f MONOFONT] [-fs MONOSIZE] [-nf NBFONT]
          [-nfs NBFONTSIZE] [-tf TCFONT] [-tfs TCFONTSIZE] [-m MARGINS]
          [-cursw CURSORWIDTH] [-cursc CURSORCOLOR] [-cellw CELLWIDTH]
          [-lineh LINEHEIGHT] [-alt] [-vim] [-T] [-N] [-r]
options arg default
Usage help -h --
List Themes -l --
Theme Name to Install -t --
Code Font -f droidmono
Code Font-Size -fs 11
Notebook Font -nf exosans
Notebook Font Size -nfs 13
Text/MD Cell Font -tf loraserif
Text/MD Cell Fontsize -tfs 13
Intro Page Margins -m auto
Cell Width -cellw 980
Line Height -lineh 170
Cursor Width -cursw 2
Cursor Color -cursc --
Alt Text/MD Layout -alt --
Alt Prompt Layout -altp --
Style Vim NBExt* -vim --
Toolbar Visible -T --
Name & Logo Visible -N --
Restore Default -r --

举个例子
jt -t oceans16 -f roboto -fs 15
意味着选择oceans16主题,roboto字体,大小为15,效果如下。


恢复原始主题,重新启动Jupyter notebook,如果主题没有改变,Ctrl+F5刷新即可。
# restore default themejt -r

jupyter notebook换工作空间

  • 打开 cmd 输入命令
    jupyter notebook --generate-config
  • 进入自己工作目录,.jupyter,打开jupyter_notebook_config.py
  • ctrl+f查到c.NotebookApp.notebook_dir
    将这一行改为c.NotebookApp.notebook_dir = '自己的位置'
  • 启动 jupyter notebook


相关文章

网友评论

    本文标题:jupyter notebook使用帮助

    本文链接:https://www.haomeiwen.com/subject/oktivttx.html