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

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