使用 Jupyter Themes 修改 Jupyter Notebook 的主题、字体、字号

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Jerry_xzj/article/details/89931165

Jupyter Notebook默认主题太亮,字太小,字体太丑,窗口宽度太窄。今天用 Github 上名叫 Jupyter Themes的工具更改了Jupyter Notebook的主题,在此记录我做的配置。

1. 安装

  • Requirements
    • Python 2.7, 3.4, 3.5, 3.6
    • Jupyter (Anaconda recommended)
    • matplotlib

for best results: use notebook>=5.6.0 (pip install --upgrade notebook)

  • install with pip
# install jupyterthemes
pip install jupyterthemes

# upgrade to latest version
pip install --upgrade jupyterthemes

2. 使用

  • 列出所有主题,其中onedorkmonokaioceans16chesterish为暗色主题,个人喜欢onedork
# onedork | grade3 | oceans16 | chesterish | monokai | solarizedl | solarizedd
jt -l
  • 我使用的配置如下,设置了主题、代码字体、宽度、显示工具栏、显示文件名、显示内核图标、Markdown部分无底色(因为黑色主题有底色的话不好区分)
jt -t onedork -f hasklig -cellw 80% -T -N -kl -altmd
  • 特别说一下,默认是隐藏了文件名、内核图标的。可以使用参数-N -kl打开。但是因为上下滚动的时候会一直显示,比较占地方,所以屏幕小的时候可以不加这两个参数。
jt -t onedork -f hasklig -cellw 80% -T -altmd
展开阅读全文

Jupyter Notebook主题编码问题

02-10

最近因为jupyter notebook的白色原装界面太难看了,特别是字体。然后,就install nJupyter themes; 一切都OK,themes也下载下来了,进行 jt -l 也是没问题的,正常n显示出了已经有的各个主题了。n最后,进行 jt -t 主题名 启用时,报错了。无法切换主题:nn(C:\Users\Administrator\Anaconda3) C:\Users\Administrator>jt -lnAvailable Themes:n chesterishn grade3n gruvboxdn gruvboxln monokain oceans16n onedorkn solarizeddn solarizedlnn(C:\Users\Administrator\Anaconda3) C:\Users\Administrator>jt -t grade3nTraceback (most recent call last):n File "c:\users\administrator\anaconda3\lib\runpy.py", line 193, in _run_module_as_mainn "__main__", mod_spec)n File "c:\users\administrator\anaconda3\lib\runpy.py", line 85, in _run_coden exec(code, run_globals)n File "C:\Users\Administrator\Anaconda3\Scripts\jt.exe\__main__.py", line 9, in n File "c:\users\administrator\anaconda3\lib\site-packages\jupyterthemes\__init__.py", line 307, in mainn dfonts=args.defaultfonts)n File "c:\users\administrator\anaconda3\lib\site-packages\jupyterthemes\__init__.py", line 103, in install_themen style_css = stylefx.less_to_css(style_less)n File "c:\users\administrator\anaconda3\lib\site-packages\jupyterthemes\stylefx.py", line 63, in less_to_cssn style_css = lesscpy.compile(tempfile)n File "c:\users\administrator\anaconda3\lib\site-packages\lesscpy\__init__.py", line 18, in compilen p.parse(file=file)n File "c:\users\administrator\anaconda3\lib\site-packages\lesscpy\lessc\parser.py", line 154, in parsen file, lexer=self.lex, debug=debuglevel)n File "c:\users\administrator\anaconda3\lib\site-packages\ply\yacc.py", line 331, in parsen return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)n File "c:\users\administrator\anaconda3\lib\site-packages\ply\yacc.py", line 1024, in parseopt_notrackn lexer.input(input)n File "c:\users\administrator\anaconda3\lib\site-packages\lesscpy\lessc\lexer.py", line 475, in inputn self.lexer.input(f.read())nUnicodeDecodeError: 'gbk' codec can't decode byte 0x8b in position 44256: illegal multibyte sequencen 问答

没有更多推荐了,返回首页