JupyterLab
本文最后更新于:2025年4月29日 下午
JupyterLab
介绍:
官方文档:Link
JupyterLab 是 Project Jupyter 旗下其他笔记本编写应用程序(如 Jupyter Notebook 和 Jupyter Desktop)的同胞兄弟。与 [Jupyter Notebook](https://so.csdn.net/so/search?q=Jupyter Notebook&spm=1001.2101.3001.7020) 相比,JupyterLab 提供了更先进、功能更丰富、可定制的体验。
安装
官方文档: Link
pip install jupyterlab
Jupyter Kernel 与 conda 虚拟环境
建议:在每个虚拟环境中都完整地安装 jupyterlab
(在运行前一定要激活所需的虚拟环境)。
在使用时,用这个默认的 Kernel 即可,它调用的就是所在虚拟环境的 Python Interpreter。
可以用下面的代码运行验证一下:
import os
import sys
print(f"Python 版本信息: {sys.version}")
print(f"\n解释器路径: {sys.executable}")
print(f"\n当前工作目录: {os.getcwd()}")
此外,这篇问答 How to use Jupyter notebooks in a conda environment? 给出了 3 种不同的使用方式,想要尝试的话可以参考。
使用
安装中文包
官方文档: Link
pip install jupyterlab-language-pack-zh-CN
切换为中文:
启动
–no-browser: 禁止启动时自动打开浏览器
–ip=
–port=
–notebook-dir=
–app-dir=
–pylab=
jupyter lab --notebook-dir=E:/ --preferred-dir E:/Documents/Somewhere/Else
常用快捷键
ESC
: 切换到命令模式ENTER
: 切换到编辑模式Ctrl
+Enter
: 运行 CellShift
+Enter
: 运行 Cell,并切换至下一个 Cell
自动补全和文档提示
- 自动补全:
Tab
- 文档提示:
Shift + Tab
- 使用问号:
?
魔术符号
- 行魔术:
%
- 格子魔术:
%%
- 列举所有魔术符号:
%lsmagic