anaconda3切换国内镜像源
时间: 2025-05-06 17:14:41 浏览: 29
### 配置 Anaconda3 使用中国国内镜像源
为了提高 `conda` 安装软件包的速度,在国内可以将默认的镜像源更改为中国的镜像源,比如清华大学的镜像源。更改方法如下:
#### 方法一:临时设置(仅对当前命令有效)
可以在每次执行 `conda install` 命令时指定使用清华镜像源:
```bash
conda install -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/<channel-name> <package_name>
```
#### 方法二:永久修改配置文件
通过编辑 `.condarc` 文件来实现长期生效的方式。
1. 打开终端并输入以下指令添加清华镜像作为通道之一:
```bash
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
```
2. 设置搜索频道时优先考虑国内镜像:
```bash
conda config --set show_channel_urls yes
```
3. 如果希望彻底替换原有的默认官方仓库列表,则可以通过下面这条语句清空原有channels后再重新加入新的渠道:
```bash
conda config --remove-key channels
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
```
完成上述操作之后就可以享受更快捷稳定的下载体验了[^2]。
阅读全文
相关推荐


















