Monthly Archives: September 2022

jupyter-lab多环境安装

By | September 11, 2022

当你同时需要python 3.7和3.8版本,或者库依赖出现冲突的时候,可以通过conda的env安装多个环境,但这个时候怎么在jupyter中选择不同的环境呢? 简单的做法是每个环境各装一个jupyterlab,但使用的时候切来切去非常难受。 既然jupyter有kernel机制,我们就来稍微研究一下吧。 环境信息 假设你已经装好了conda,通过 1conda info 命令查看环境信息,主要是得到active env location,后面会用到。 <code class="language-bash">active environment : base active env location : /opt/homebrew/Caskroom/miniforge/base</code> 安装jupyterlab 我们只在base环境安装jupyterlab,使用命令 1pip install jupyterlab <code class="language-bash">… Successfully installed jupyterlab-3.4.6 …</code> 键入 1jupyter-lab 命令即可启动,这时候会在浏览器自动打开http://localhost:8888/lab 这时只有一个Python 3的图标,对应的是base环境的python 3.9 安装 python 3.8 <code class="language-bash"># 创建一个独立的py38环境 conda create -n py38 python=3.8 # 激活这个环境 conda activate py38 #… Read More »