一、下载Miniconda
二、安装Miniconda
三、在系统环境变量中添加PATH
| C:\Users\用户名\miniconda3 |
| C:\Users\用户名\miniconda3\Scripts |
| C:\Users\用户名\miniconda3\Library\bin |
四、初始化Powershell
| Conda init powershell ## 根据终端名称进行初始化 |
| |
| # Currently supported shells are: |
| # - bash |
| # - cmd.exe |
| # - fish |
| # - tcsh |
| # - xonsh |
| # - zsh |
| # - powershell |
五、重新打开Powershell如果报错
| set-executionpolicy remotesigned ## 回复 Y |
六、取消Conda初始化(base)环境
- 如果不想每次打开Powershell都进入Conda的(base)环境,执行下面命令取消自动激活。
- 最后一个参数设置为
True即可恢复。
| conda config --set auto_activate_base False |
七、更改镜像源
- 网络原因需要设置国内的镜像源,安装提速,我这里提供清华镜像源设置方法。
- 方法很多种,只提供下列一种方法。
| 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/pytorch/ |
| |
| conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ |
| |
| conda config --set show_channel_urls yes |
八、Conda基本的使用
- 参数说明
- -n, --name 表示名称
- --clone 复制一个存在的虚拟环境
1. 查看当前所有虚拟环境
| conda env list |
| # or |
| conda info -e |
2. 创建虚拟环境
| conda create -n (ENV_NAME) [Python=3.9] |
3. 激活虚拟环境
| conda activate (ENV_NAME) |
4. 退出虚拟环境
5. 删除某个虚拟环境
| conda remove -n (ENV_NAME) --all |
6. 克隆虚拟环境
| conda create -n (ENV_NAME_OLD) --clone (ENV_NAME_NEW) |
文章引用地址:https://www.cnblogs.com/trendyshuai/p/17068775.html