配置镜像源
本人只推荐清华源或者阿里源
# 清华源
conda config --add channels https://pypi.tuna.tsinghua.edu.cn/simple
# 阿里源
conda config --add channels https://mirrors.aliyun.com/pypi/simple/
查看默认源
conda config --show-sources
删除一个默认源
conda config --remove channels https://pypi.tuna.tsinghua.edu.cn/simple
设置搜索时显示通道地址
conda config --set show_channel_urls yes
创建虚拟环境
conda create -n 虚拟环境名 python=版本号
遇到报错:
UnavailableInvalidChannel: HTTP 404 NOT FOUND for channel simple
先删除镜像:
conda config --remove-key channels
添加镜像:
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
显示添加的镜像:
conda config --show channels
再重新去新建conda虚拟环境
查看所有的conda虚拟环境
conda env list
或者
conda info -e
进入虚拟环境
conda activate 虚拟环境名
退出当前虚拟环境,回到base
source deactivate
删除某个整个conda虚拟环境
conda remove -n 虚拟环境名 --all
复制虚拟环境
conda create --name new_env_name --clone old_env_name
在conda虚拟环境中安装 安装包
只在conda虚拟环境中装,不在pip环境中装:
conda install 包名
查看当前装了哪些包
先切换到需要安装的conda虚拟环境
查看pip中有哪些包:
pip list
查看conda虚拟环境中有哪些包:文章来源:https://www.toymoban.com/news/detail-814631.html
conda list
也可以指定具体的虚拟环境(不切换,直接指定查看哪个虚拟环境)文章来源地址https://www.toymoban.com/news/detail-814631.html
conda list -n env_name
到了这里,关于conda 虚拟环境相关命令的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!