Ananconda使用指南

107 阅读1分钟

ananconda官网

管理conda环境

展示所有环境

conda env list

创建虚拟环境

conda create -n Ginkgo python=3.9
conda create -n Ginkgo

这么创建会没有python解释器,要指定pyhton版本!!!

删除虚拟环境

conda remove -n Ginkgo --all

激活虚拟环境

conda activate Ginkgo

image.png

退出虚拟环境

conda deactivate

管理镜像源

# 配置阿里云镜像源   (已失效)
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/main/
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/r/
conda config --add channels http://mirrors.aliyun.com/anaconda/pkgs/msys2/
conda config --set show_channel_urls yes

# 配置清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

# 查看配置的镜像源
conda config --show channels

# 删除镜像源
conda config --remove channels 镜像源地址

踩坑记录:

当创建conda环境时如果没有指定pyhon版本,会导致新环境中没有python解释器,以至于在新环境下使用pip install会导致包被下载到base环境中 解决方案就是,删掉这个虚拟环境,然后重新创建(创建的时候指定版本)

配置VSCode使用conda环境

下载插件

image.png

配置运行环境

ctrl + shift + p进入全局搜索,搜索python解释器

image.png 选择需要使用的解释器即可 image.png

此时即可看到插件栏已有对应的conda环境 image.png