查看conda版本
conda --version
设置源
Windows 用户无法直接创建名为 .condarc
的文件,可先执行 conda config --set show_channel_urls yes
会在C:/Users/用户名/
下生成该文件之后再修改。
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- defaults
show_channel_urls: true
注意如果需要pytorch
, 还需要添加pytorch
的镜像:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
如果需要换回conda的默认源,直接删除channels即可,命令如下:
conda config --remove-key channels
检测目前安装了哪些环境变量
conda info --envs
创建新环境
conda create --name pytorch python=3.6
离线创建环境
conda create --name my_test --offline python=3.6
激活环境
conda activate pytorch
删除环境
conda remove -n pytorch --all
克隆环境
conda create --name myclone --clone myenv