美文网首页
jupyter notebook使用技巧(1):更换主题

jupyter notebook使用技巧(1):更换主题

作者: xxlee | 来源:发表于2019-02-20 23:10 被阅读0次

转载请在文章起始处注明出处,谢谢。

jupyter notebook默认的主题为白色背景,长期使用眼睛差点亮瞎,正好看到可以更换主题,想来可以换个保护下视力。

打开cmder(点我点我)(比cmd更友好,墙裂推荐),使用pip安装(至于为啥conda不能安装,我也不太清楚,还望知道的大佬告知下)Github上大神提供的包jupyterthemes(点我点我)

1、jupyterthemes安装

安装之前请先将pip升级到最新。

python -m pip install --upgrade pip

如果下载比较卡,可以临时改用国内源,即在命令结尾加上-i https://pypi.tuna.tsinghua.edu.cn/simple,后续安装都可以。

python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple

安装jupyterthemes。

pip install jupyterthemes -i https://pypi.tuna.tsinghua.edu.cn/simple

竟然报错了:



错误信息:

 Cannot uninstall 'jupyter-client'. It is a distutils installed project and thus we cannot accurate ly determine which files belong to it which would lead to only a partial uninstall.

百度下发现有大佬遇到过此类问题(原文点这里),解决办法直接到anaconda安装目录下,搜索对应包的名字,删掉对应文件夹.egg-info文件即可。完美解决!

重新运行安装命令,完成jupyterthemes的安装。

Successfully installed jupyterthemes-0.20.0

2、选择主题

通过以下命令查看主题种类。

jt -l

有下面主题可以选择。


我选择monikai:

jt -t monokai

打开jupyter notebook,主题效果如下:



如果不喜欢,可以用上述命令更换其他主题。

如果还是喜欢原生的,命令如下:

jt -r

3、设置主题参数

我的主题设置详细参数如下:

jt  -t oceans16 -f consolamono -tf ptmono -ofs 10 -nfs 13 -tfs 13 -fs 12 -T -N -lineh 140

效果如下:


更多参数设置,请参考jupyterthemes参数设置说明:

4、小彩蛋

设置好主题后,开开心心去打开ipynb文件,然后。。



更新jupyter notebook后完美解决。

conda update jupyter notebook

至此,设置完成,开心撸代码去。

相关文章

网友评论

      本文标题:jupyter notebook使用技巧(1):更换主题

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