conda下增删虚拟环境,添加内核

人工智能101

1.进入anaconda prompt,利用以下命令查看conda下已存在的虚拟环境:

conda env list

显示如下:

# conda environments:
#
base                  *  I:\Anaconda3
tensorflow               I:\Anaconda3\envs\tensorflow
tensorflowq              I:\Anaconda3\envs\tensorflowq

2.删除名为tensorflow的虚拟环境:

conda remove -n tensorflow --all

常规命令格式:

conda remove -n env_name --all

查看现有虚拟环境,删除虚拟环境tensorflow成功

conda下增删虚拟环境,添加内核

  1. 创建虚拟环境,并为其创建内核

(1)创建名为"tensorflow_case"的虚拟环境

conda create -n tensorflow_case python=3.7

可以利用下述命令,查看虚拟环境是否创建成功

conda env list

(2)激活虚拟环境

conda activate tensorflow_case

我激活环境的时候遇到以下情况:

Your shell has not been properly configured to use 'conda activate'. If your shell is Bash or a Bourne variant, enable conda for the current user

利用以下命令首次激活环境,之后激活便可以利用conda activate ... ...

source activate environment_name

(3)通过(2)进入虚拟环境,创建内核

在虚拟环境tensorflow_case下利用conda install ##命令安装内核:

conda install ipykernel

创建名为"tensorflow_case"的内核:

python -m ipykernel install --user --name tensorflow_case

查看现有可用的内核:

jupyter kernelspec list

显示:

Available kernels:
  python3            C:\Users\12345\AppData\Roaming\jupyter\kernels\python3
  tensorflow_case    C:\Users\12345\AppData\Roaming\jupyter\kernels\tensorflow_case
  tensorflowq        C:\Users\12345\AppData\Roaming\jupyter\kernels\tensorflowq

删除内核:

jupyter kernelspec remove tensorflow_case

查看可用内核:

jupyter kernelspec list
Available kernels:
  python3        C:\Users\12345\AppData\Roaming\jupyter\kernels\python3
  tensorflowq    C:\Users\12345\AppData\Roaming\jupyter\kernels\tensorflowq

Conda 创建和删除虚拟环境_CV前沿-CSDN博客_anaconda删除虚拟环境

anacaoda中创建虚拟环境,并在jupyter中添加内核(kernel)_肖泽的博客-CSDN博客_jupyter创建内核

Original: https://blog.csdn.net/qq_43270444/article/details/122034676
Author: keep_humble
Title: conda下增删虚拟环境,添加内核