conda换源 mac
时间: 2025-02-15 10:10:02 浏览: 71
### 更改 macOS 上 Conda 的国内镜像源
为了提高软件包的下载速度并优化体验,在 macOS 上配置 Conda 使用国内镜像源是一个不错的选择。具体操作如下:
#### 修改 `.condarc` 文件
可以通过编辑用户目录下的`.condarc`文件来设置镜像站[^1]。
```bash
nano ~/.condarc
```
在该文件中添加或修改 `channels` 字段,指向所需的国内镜像地址。例如使用清华大学的镜像源:
```yaml
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
```
保存并关闭文件后,新的配置将会生效。
#### 命令行方式更新通道列表
另一种方法是直接通过命令行工具来进行配置,这种方式更加便捷。对于希望快速完成换源工作的用户来说非常实用[^2]。
```bash
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 --set show_channel_urls yes
```
如果还需要加入其他常用的第三方库如 conda-forge 或 msys2,则可继续追加相应的 URL 地址[^3]:
```bash
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/
```
以上就是关于如何在 macOS 平台上更改 Conda 国内镜像源的方法说明。
阅读全文
相关推荐


















