jupyterlab 安装

姚浩歌
2023-12-01

一、安装

pip install jupyterlab
pip install jupyterlab-language-pack-zh-CN

二、生成配置文件

jupyter lab --generate-config

然后修改生成的配置文件就可以了

c.ServerApp.allow_remote_access = False
c.ServerApp.ip = '0.0.0.0'
c.ServerApp.open_browser = False
c.ServerApp.password = 'sha1**********'
c.ServerApp.port = 8888

c.ServerApp.password 设置登录密码

三、插件管理

注意:如果没有出现插件选项卡,可以通过 setting–>Advanced Settings Editor–Extension Manager :在User Overrides 添加语句{“enabled”: true},最后保存,就可以出现插件选项
当然,你也可以使用命令行方式进行插件的查看、安装、更新和删除

查看已安装插件:jupyter labextension list
更新已安装插件:jupyter labextension update --all
安装插件toc:jupyter labextension install @jupyterlab/toc
删除插件toc:jupyter labextension uninstall @jupyterlab/toc

四、常用插件


REM 安装matplotlib 插件
pip install ipympl
pip install npm
pip install nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib

REM 安装lsp插件
pip install jupyter-lsp
pip install python-lsp-server[all]
pip install python-language-server[all]
jupyter labextension install @krassowski/jupyterlab-lsp

REM 安装code formatter 插件
pip install jupyterlab_code_formatter
jupyter labextension install @ryantam626/jupyterlab_code_formatter
pip install black isort


REM jupyterlab-toc帮助我们在notebook界面利用markdown来创建目录,辅助我们更好地整合梳理数据分析工作流
jupyter labextension install @jupyterlab/toc

jupyter labextension install @jupyterlab/debugger-extension

REM 在jupyter lab中进行debug
jupyter labextension install @jupyterlab/debugger

REM jupyterlab-drawio是一个让我们可以在jupyter lab界面内基于drawio绘制流程图、思维导图等示意图的插件
jupyter labextension install jupyterlab-drawio

REM jupyter-matplotlib帮助我们在notebook界面配合matplotlib实现交互式的作图,只需要在绘图之前执行魔法命令%matplotlib widget,之后绘制的所有matplotlib图表即可自动转换为交互式的
pip install ipympl
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-matplotlib

REM jupyterlab-execute-time插件帮助我们在jupyter lab中记录每个单元cell的执行开始以及运行耗时
jupyter labextension install jupyterlab-execute-time

REM jupyterlab-plotly是一款帮助plotly图像在jupyter lab中正常渲染的插件
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget

REM jupyterlab-spreadsheet帮助我们在jupyter lab中查看表格类文件,特别是其支持查看多工作表的excel表格文件
jupyter labextension install jupyterlab-spreadsheet

REM jupyterlab-system-monitor通过在jupyter lab界面中添加资源监视器部件,能帮助我们在工作过程中方便的看到CPU、内存的实时占用情况:
pip install nbresuse
jupyter labextension install jupyterlab-topbar-extension jupyterlab-system-monitor

REM 通过使用在JupyterLab中添加对markdown的其他渲染支持 markdown-it,以及以下内容 插件
pip install jupyterlab_markup
jupyter labextension install @agoose77/jupyterlab-markup

pip install jupyterlab_latex
jupyter labextension install @mflevine/jupyterlab_html
pip install jupyterlab-dash
pip install jupyterlab-github

REM 该插件可以在Lab中展示plotly可视化效果。
pip install jupyterlab-fasta
pip install jupyterlab-geojson
pip install jupyterlab-katex
pip install jupyterlab-mathjax3
pip install jupyterlab-vega2
pip install jupyterlab-vega3
pip install jupyterlab-plotly

REM 该插件可以在Lab中展示bokeh可视化效果。
pip install jupyter_bokeh

REM 该插件可以在Lab中连接数据库,并进行sql查询和修改操作。会报错:The extension "jupyterlab-sql" is outdated
REM pip install jupyterlab_sql

五、代码自动提示完成

pip install jupyter-lsp
pip install python-lsp-server[all]
jupyter labextension install @krassowski/jupyterlab-lsp

依次点击[【设置】–>【高级设置编辑器】(【Settings】–>【Advanced Settings Editor】)

选择Code Completion,在右侧输入如下代码,并保存,即可开启Hinterland mode

{
"continuousHinting": true
}

六、安装完毕插件列表:

jupyter labextension list


JupyterLab v3.4.3
.\share\jupyter\labextensions
        jupyter-matplotlib v0.11.1 enabled ok
        jupyterlab-plotly v5.8.2 enabled ok
        jupyterlab_pygments v0.2.2 enabled ok (python, jupyterlab_pygments)
        @agoose77/jupyterlab-markup v2.0.0 enabled ok (python, jupyterlab_markup)
        @bokeh/jupyter_bokeh v3.0.4 enabled ok (python, jupyter_bokeh)
        @jupyter-widgets/jupyterlab-manager v3.1.0 enabled ok (python, jupyterlab_widgets)
        @jupyterlab/fasta-extension v3.2.0 enabled ok (python, jupyterlab-fasta)
        @jupyterlab/geojson-extension v3.2.0 enabled ok (python, jupyterlab-geojson)
        @jupyterlab/katex-extension v3.3.0 enabled ok (python, jupyterlab-katex)
        @jupyterlab/latex v3.1.0 enabled ok (python, jupyterlab-latex)
        @jupyterlab/mathjax3-extension v4.3.0 enabled ok (python, jupyterlab-mathjax3)
        @jupyterlab/server-proxy v3.2.1 enabled ok
        @jupyterlab/vega2-extension v3.2.0 enabled ok (python, jupyterlab-vega2)
        @jupyterlab/vega3-extension v3.2.0 enabled ok (python, jupyterlab-vega3)
        @ryantam626/jupyterlab_code_formatter v1.4.11 enabled ok (python, jupyterlab-code-formatter)

Other labextensions (built into JupyterLab)
   app dir: D:\apply\Python3104\share\jupyter\lab
        @jupyterlab/debugger v3.4.3 enabled ok
        @jupyterlab/toc v5.4.3 enabled ok
        @krassowski/jupyterlab-lsp v3.10.1 enabled ok
        jupyterlab-drawio v0.9.0 enabled ok
        jupyterlab-spreadsheet v0.4.1 enabled ok
        jupyterlab-system-monitor v0.7.0 enabled ok
        jupyterlab-topbar-extension v0.6.0 enabled ok
        plotlywidget v4.14.3 enabled ok

 类似资料: