在 jupyterlab 和 jupyter notebook 中集成conda虚拟环境

时间:2023-03-10 07:07:57
在 jupyterlab 和 jupyter notebook 中集成conda虚拟环境

在jupyterlab中切换虚拟环境使用jupyter-conda包,参考链接:https://pypi.org/project/jupyter-conda/

Install
Requirements conda >= 4.5
notebook >= 4.3
JupyterLab 1.0 (for the jupyterlab extension only) To install in the classical notebook: conda install -c conda-forge jupyter_conda To install in the JupyterLab: conda install -c conda-forge jupyterlab jupyter_conda
jupyter labextension install jupyterlab_toastify jupyterlab_conda

之前采用的是nb_conda_kernels包,该包在jupyter notebook中运行良好,但在jupyterlab中失效,切换虚拟环境运行无效。

jupyter-conda包是nb_conda_kernels包的分支,这是官网的解释:

Provides Conda environment and package access extension from within Jupyter Notebook and JupyterLab.

This is a fork of the Anaconda nb_conda package. The decision to fork it came due to apparently dead status of the previous package and a need to integrate it within JupyterLab.