本文最后更新于:2024年1月14日 晚上

jupyterlab 作为 jupyter 的扩展版本,易用性强,结果保存很合理。突然发现可以添加debugger插件,实现在jupyterlab中调试代码,本文记录方法。

基本流程

  • 安装 Anaconda
  • 安装 jupyterlab
  • 安装 node.js
  • 安装 xpython
  • 建立 jupyterlab 工程
  • 搜索并安装插件
  • 使用插件进行debug

具体步骤

安装Anaconda

安装jupyterlab

1
pip install jupyterlab

安装 node.js

如果不装会报错:

1
2
3
4
An error occurred installing <code>@jupyterlab/debugger-extension</code>.
Error message:

Please install Node.js and npm before continuing installation. You may be able to install Node.js from your package manager, from conda, or directly from the Node.js website (https://nodejs.org).
1
2
wget https://nodejs.org/dist/v14.17.3/node-v14.17.3-linux-x64.tar.xz    // 下载
tar xf node-v14.17.3-linux-x64.tar.xz // 解压

之后添加环境变量到 /etc/profile~/.bashrc 文件

1
export PATH=$PATH:/path_to/node-v14.17.3-linux-x64/bin
  • 测试
1
2
# node -v
v14.17.3

安装 xpython

1
pip install xeus-python

JupyterLab 2.0+

xeus-python 0.8.0+

notebook 6+

  • 随后可以使用 xpython

建立 jupyterlab 工程

1
jupyter lab --allow-root --no-browser --ip 0.0.0.0 --port 8080 --notebook-dir /workspace/nfs

搜索并安装插件

  • 进入 jupyterlab, enable Warning 中的内容即可使用扩展

  • 搜索并安装插件

安装 @jupyterlab/debugger

  • 可以搜索之间单击 install
  • 也可以执行命令
1
jupyter labextension install @jupyterlab/debugger

使用插件进行debug

  • 建立 xpython 工程
  • 设置断点,debug 程序

参考资料



文章链接:
https://www.zywvvd.com/notes/coding/python/jupyter-lab-extension/jupyter-lab-extension/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

为 jupyterlab 添加 debugger 扩展
https://www.zywvvd.com/notes/coding/python/jupyter-lab-extension/jupyter-lab-extension/
作者
Yiwei Zhang
发布于
2021年7月8日
许可协议