How to display line numbers in IPython Notebook code cell by default

后端 未结 3 1918
谎友^
谎友^ 2020-12-13 13:56

I would like my default display for IPython notebook code cells to include line numbers.

I learned from Showing line numbers in IPython/Jupyter Notebooks that I can

3条回答
  •  旧巷少年郎
    2020-12-13 14:41

    Above didn't work for me in 2018

    I found that inside ~/.jupyter/nbconfig/notebook.json I needed to add to add the following lines:

    "CodeCell": {
      "cm_config": {
      "lineNumbers": true
    }
    

    inside the object that was there. So the final object would look like:

    {
      "CodeCell": {
        "cm_config": {
          "lineNumbers": true
        }
      }
    }
    

提交回复
热议问题