[快速学]Anaconda创建虚拟环境

创建/删除环境:

 #查看conda虚拟环境列表
conda env list
#创建一个名为testpy的python3.10环境
conda create -n testpy python==3.10
#进入环境testpy
activate testpy
#退出环境
deactivate
#删除环境testpy
conda remove -n testpy --all

换源:

 #查看当前下载源
conda config --show-sources
#添加源
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
#从channel中安装包时显示channel的url,这样就可以知道包的安装来源
conda config --set show_channel_urls yes
#还原默认源
conda config --remove-key channels

 

标签: python

添加新评论