Miniconda config channels的查看、删除、添加

这里写自定义目录标题

    • [1. 背景](#1. 背景)
    • [2. 配置文件.condarc](#2. 配置文件.condarc)
    • [3 show channels 的工作机制](#3 show channels 的工作机制)
    • [4. 初始配置](#4. 初始配置)
    • [5. 参考连接](#5. 参考连接)

@创建于:2025.12.13

@修改于:2025.12.13

1. 背景

miniconda里面安装pandas的时候报错

复制代码
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): /

若长时间卡在此步骤,可尝试:

1、清除conda缓存 conda clean --all ,然后重试。

2、一次性使用清华源conda install pandas==2.2.3 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

3、使用pip安装(更简单快速)pip install pandas==2.2.3 -i https://pypi.tuna.tsinghua.edu.cn/simple

2. 配置文件.condarc

.condarc是conda 应用程序的配置文件,在用户家目录(windows:C:\users\username\),用于管理镜像源。如果不存在,则打开conda的,执行一下:

bash 复制代码
conda config --show channels

3 show channels 的工作机制

很多人以为列表第一个 channel 优先级最高,其实是反的!Conda 默认采用 "后进先出" 的查找策略:

bash 复制代码
channels:
  - A
  - B
  - C

查找顺序是:A → B → C

4. 初始配置

对.condarc进行初始配置,是装完 Miniconda 做的第一件事,这个很重要。

bash 复制代码
# 添加清华镜像源(注意顺序!)
conda config --add channels defaults

conda config --add channels conda-forge

conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

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 channel_priority strict

# 验证是否生效
conda config --show channels

# 显示镜像源站点
conda config --set show_channel_urls yes

.condarc中的内容如下

python 复制代码
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - conda-forge
  - defaults
channel_priority: strict
show_channel_urls: true

推荐组合:

  • 清华源:速度快,更新及时;
  • conda-forge:社区维护,包最全,很多前沿库只在这里有;
  • defaults:作为最终保障。

5. 参考连接

Miniconda config show channels查看当前源配置

Conda Channels镜像源(通道)配置

【Python】conda镜像配置,.condarc文件详解,channel镜像

相关推荐
d1z8881 天前
(十八)32天GPU测试从入门到精通-TensorRT-LLM 部署与优化day16
人工智能·python·深度学习·gpu·tensorrt
qq_283720051 天前
Python 面向对象编程(OOP)从入门到精通
python·oop·面对对象
linux_map1 天前
大模型微调实战指南
人工智能·python·ai·策略模式
deephub1 天前
向量相似性搜索详解:Flat Index、IVF 与 HNSW
人工智能·python·机器学习·embedding·向量检索
宸津-代码粉碎机1 天前
Spring Boot 4.0 实战技巧全解析
java·大数据·spring boot·后端·python
深度学习lover1 天前
<数据集>yolo微藻识别<目标检测>
人工智能·python·yolo·目标检测·计算机视觉·微藻识别
程序媛徐师姐1 天前
Python基于OpenCV的马赛克画的设计与实现【附源码、文档说明】
python·opencv·django·马赛克绘画·python马赛克绘画系统·马赛克画·python马赛克画
DeepModel1 天前
通俗易懂讲透随机梯度下降法(SGD)
人工智能·python·算法·机器学习
小锋java12341 天前
【技术专题】Matplotlib3 Python 数据可视化 - Matplotlib3 绘制条形图(Bar)
python
zhangzeyuaaa1 天前
Python推导式(Comprehensions)
开发语言·python