jupyter notebook配置

本文记录使用jupyter notebook过程中的配置问题!

Jupyter notebook好用的插件

  1. 安装jupyter notebook插件工具栏

    1
    pip install jupyter_contrib_nbextensions
  2. 添加插件选项工具栏到jupyter notebook页面中

    1
    jupyter contrib nbextension install
  3. 选择好用的插件

    • Hinterland:代码自动填充
    • Skip-Traceback:省略繁杂的错误提示信息
    • Live Markdown Preview:Markdown实时渲染
    • Highlighter:摘选高亮
    • Spell Checker:拼写错误检查
    • Code prettify:格式化代码
    • Codefolding:代码折叠
    • ExecuteTime:代码执行时长
    • Table of Contents:自动生成目录
    • Variable Inspector :这是一个查看变量的插件

更改Code字体

  1. 找到控制字体的css文件:

    1
    /home/huangyedi2012/.conda/envs/pytorch/lib/python3.9/site-packages/notebook/static/components/codemirror/lib
  2. 修改css文件:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    .CodeMirror pre.CodeMirror-line,
    .CodeMirror pre.CodeMirror-line-like {
    /* Reset some styles that the rest of the page might have set */
    -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
    border-width: 0;
    background: transparent;
    font-family: 'Courier New';
    font-size: inherit;
    margin: 0;
    white-space: pre;
    word-wrap: normal;
    line-height: 1.5;
    color: inherit;
    z-index: 2;
    position: relative;
    overflow: visible;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-variant-ligatures: contextual;
    font-variant-ligatures: contextual;
    }