jupyter lab 使用小技巧

jupyter界面

执行shell命令

在要执行的命令之前加上叹号
如
!pwd
我们还可以将叹号的shell输出分配给python
X = !pwd

更换主题

可因通过执行以下命令安装主题插件

sudo pip install jupyterthemes

列出可用主题

jt -l

笔记本扩展

默认无插件栏
点击菜单栏Settings下拉框中的Advanced Settings Editor选项,会出现一个设置页面。

点击齿轮图标
接着,点击Extension Manager,并且在右边的空白框里填上{‘enabled’:true},并且按右上角的保存按钮。

你可以在搜索栏搜索想要的插件,并直接安装。

插件栏
下面就来介绍15款非常nice的Jupyter Lab插件

  1. github
    安装这个插件后,JupyterLab左侧会出现一个github栏按钮,你可以在里面搜索github项目,并且打开项目里面的文件,如果是notebook文件,能够直接运行代码。

这个插件非常适合在Lab上学习github项目,方便高效。
https://github.com/jupyterlab/jupyterlab-github

  1. toc
    这是一个Lab的目录插件,安装后就能很方便地在Lab上展示notebook或者markdown的目录。
    目录可以滚动,并且能展示或隐藏子目录。
    https://github.com/jupyterlab/jupyterlab-toc

  2. LaTeX
    支持在线编辑并预览LaTeX文档。
    https://github.com/jupyterlab/jupyterlab-latex

  3. HTML
    该插件允许你在Jupyter Lab内部呈现HTML文件,这在打开例如d3可视化效果时非常有用。
    https://github.com/mflevine/jupyterlab_html

  4. plotly
    该插件可以在Lab中展示plotly可视化效果。
    https://github.com/jupyterlab/jupyter-renderers

  5. bokeh
    该插件可以在Lab中展示bokeh可视化效果。
    https://github.com/bokeh/jupyter_bokeh

  6. matplotlib
    该插件可以在Lab中启用matplotlib可视化交互功能。
    https://github.com/matplotlib/jupyter-matplotlib

  7. drawio
    该插件可以在Lab中启用drawio绘图工具,drawio是一款非常棒的流程图工具。
    https://github.com/QuantStack/jupyterlab-drawio

  8. sql
    该插件可以在Lab中连接数据库,并进行sql查询和修改操作。
    https://github.com/pbugnion/jupyterlab-sql

  9. variableinspector
    该插件可以在Lab中展示代码中的变量及其属性,类似RStudio中的变量检查器。你可以一边撸代码,一边看有哪些变量。
    https://github.com/lckr/jupyterlab-variableInspector

  10. dash
    该插件可以在Lab中展示plotly dash交互式面板。
    https://awesomeopensource.com/project/plotly/jupyterlab-dash

  11. go to Definition
    该插件用于在Lab笔记本和文件编辑器中跳转到变量或函数的定义。
    https://github.com/krassowski/jupyterlab-go-to-definition

  12. lsp
    该插件用于自动补全、参数建议、函数文档查询、跳转定义等。
    https://github.com/krassowski/jupyterlab-lsp

  13. spreadsheet
    该插件用于在Lab上显示excel表格,只读模式。
    https://github.com/quigleyj97/jupyterlab-spreadsheet

Jupyter Lab还有很多强大的拓展插件,感兴趣的可以去github找找,提供一个项目供参考。
https://github.com/mauhai/awesome-jup

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章