更改jupyter notebook主题

使用jupyter notebook的默认主题久了容易产生视觉疲劳,且白色背景对眼睛伤害更大,所以修改主题还是必要的

更改jupyter notebook主题

工具/原料

  • 安装jupyter notebook,若没有,请下载,下载地址参考文献

  • 主题包jupyter themes,下载地址见参考文献

方法/步骤

  1. 下载好主题包之后,在命令提示符中输入pip install --upgrade jupyterthemes,安装主题包

  2. 安装好之后,在命令提示符中输入jt -l,可以查看主题:

    Available Themes: 

    chesterish 

    grade3 

    monokai 

    oceans16 

    onedork 

    solarizedd 

    solarizedl

    那就继续执行命令: jt -t 主题名称(主题名称可以选chesterish....)

    这样就可以修改主题了,这是后打开jupyter notebook就可以看到修改后的主题了

    更改jupyter notebook主题

  3. 当然输入jt -l之后也可能报错,在命令提示符的最后一行会显示:

    UnicodeDecodeError: 'gbk' codec can't decode byte 0x8b in position 41271: illegal multibyte sequence。。。

    这可以通过下面介绍的方法修改程序来改正:

  4. 第一步、修改stylefx.py

    文件位置:D:\Anaconda3\Lib\site-packages\jupyterthemes (不同的电脑,路径不一样,具体看安装anaconda的位置)

    用jupyter notebook 打开stylefx.py,修改代码

    更改jupyter notebook主题

    更改jupyter notebook主题

  5. 第二步,修改lexer.py文件

    文件地址:D:\Anaconda3\Lib\site-packages\lesscpy\lessc  (不同的电脑,路径不一样,具体看安装anaconda的位置)

    使用jupyter notebook打开文件lexer.py 

    更改jupyter notebook主题

    更改jupyter notebook主题

  6. 最后就可以在命令提示符中输入:jt -t 主题名称  来修改jupyter notebook的主题了 ,例如输入 jt -t chesterish,打开jupyter  notebook之后就可以看到相应的主题了,见下图

    更改jupyter notebook主题

猜你喜欢

转载自blog.csdn.net/huobanjishijian/article/details/91382778