Jupyter Notebook真的是个好东西
但是用起来有两个痛点:界面太丑,没有智能提示
如何改善这两个痛点呢。
1、美化界面
首先要安装jupyterthemes
pip install --upgrade jupyterthemes
然后可以查看所具有的主题:
jt -l
结果如下
xxxx~ env:base ❯❯❯ jt -l
Available Themes:
chesterish
grade3
gruvboxd
gruvboxl
monokai
oceans16
onedork
solarizedd
solarizedl
设置方式参考下表:
cl options | arg | default |
---|---|---|
Usage help | -h | -- |
List Themes | -l | -- |
Theme Name to Install | -t | -- |
Code Font | -f | -- |
Code Font-Size | -fs | 11 |
Notebook Font | -nf | -- |
Notebook Font Size | -nfs | 13 |
Text/MD Cell Font | -tf | -- |
Text/MD Cell Fontsize | -tfs | 13 |
Pandas DF Fontsize | -dfs | 9 |
Output Area Fontsize | -ofs | 8.5 |
…… | …… | …… |
表格有所删节,详细的可以访问github页面:https://github.com/dunovank/jupyter-themes
比如我选择“chesterish”主题,“bitstream”字体,字号12
可以:
jt -t chesterish -f bitstream -fs 12
设置成功后,重启jupyter notebook就能看到效果
关于字体
可以查看主题的列表,但是如何查看字体的列表呢,目前我还不知道有什么办法,只能在官方的github的主页上看到。
-f arg | Monospace Font |
---|---|
anka | Anka/Coder |
anonymous | Anonymous Pro |
aurulent | Aurulent Sans Mono |
bitstream | Bitstream Vera Sans Mono |
bpmono | BPmono |
code | Code New Roman |
consolamono | Consolamono |
cousine | Cousine |
dejavu | DejaVu Sans Mono |
droidmono | Droid Sans Mono |
fira | Fira Mono |
firacode | Fira Code |
generic | Generic Mono |
…… | …… |
喜欢其他字体的可以多试试,也可以在字体天下直接搜索名字预览效果。
美化工作做完了,接下来是代码的智能提示
2、代码的智能提示
需要安装jupyter_contrib_nbextensions
pip install jupyter_contrib_nbextensions
接着执行
jupyter contrib nbextension install --user --skip-running-check
,之后打开jupyter notebook后,就会看到新增了一个选项
点击打开后,勾选上"Hinterland"
这样,在写代码的时候,就会有智能提示(缺点是有时候反应比较慢)