本文介绍: Hi,大家好,我是源于花海。本文主要了解如何在 jupyter 中使用 conda 虚拟环境,即在 conda 里面创建虚拟环境、将虚拟环境添加至 jupyter lab/notebook、安装软件包。

Hi,大家好,我是源于花海。本文主要了解如何在指定文件夹的 jupyter 中使用 conda 虚拟环境,即在 conda 里面创建虚拟环境、将虚拟环境添加至 jupyter lab/notebook、安装软件包。


目录

一、创建虚拟环境

二、激活并进入虚拟环境

三、安装 ipykernel

四、安装 ipykernel,将虚拟环境加入 jupyter 内核中

五、从指定文件夹里进入 jupyter


conda create -n env_name python=x.x
activate env_name
pip install ipykernel -i https://pypi.tuna.tsinghua.edu.cn/simple/
python -m ipykernel install --name env_name --display-name env_name
  • name —— 你的虚拟环境名称
  • display-name —— 在 jupyter 中想显示的名称

检查新虚拟环境是否成功加入内核:

jupyter kernelspec list
jupyter lab
或者
jupyter notebook

pip install tensorflow==2.1.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install keras==2.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
······

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注