1.安装jupyterlab_code_formatter
pip install jupyterlab_code_formatter

2.安装isort和black
pip install black isort

3.重启jupyterlab

4.右键代码块可看到Format cell