如果你想取消之前通过 conda config 添加的镜像源或设置,可以使用以下命令进行恢复或删除配置:


你遇到的错误是:

CondaHTTPError: HTTP 000 CONNECTION FAILED

这表示 Conda 无法从 conda-forge 下载 cudnn 包(或其他依赖),常见于网络不通、DNS 错误、墙阻断等问题。


✅ 解决方案一:使用国内镜像(强烈推荐)

修改 Conda 的默认源为清华镜像(更快、更稳定):

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --set show_channel_urls yes

然后再执行你之前的安装命令。


✅ 解决方案二:手动尝试重新下载(适用于偶发性错误)

Conda 的提示说这类错误 可能是网络抖动或临时不可用,可以多尝试几次:

conda clean -i  # 清除缓存索引
conda update conda
conda install cudnn=7.6.5 -c conda-forge

✅ 解决方案三:离线下载 .tar.bz2 包(不推荐但可选)

  1. 在浏览器中访问:
    https://anaconda.org/conda-forge/cudnn/files

  2. 下载 cudnn-7.6.5.32-ha8d7eb6_1.tar.bz2 对应你平台的版本。

  3. 然后用 Conda 安装:

    conda install /path/to/cudnn-7.6.5.32-ha8d7eb6_1.tar.bz2
    

✅ 检查网络代理设置(可选)

如果你使用了 VPN 或代理,请确保 conda 已正确配置环境变量:

export http_proxy=http://127.0.0.1:你的端口
export https_proxy=http://127.0.0.1:你的端口

或者直接取消代理测试一下。


✅ 一、取消添加的镜像源

列出当前的 channel 设置:

conda config --show channels

如果你之前添加了清华源或其他镜像,比如:

- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

可以使用以下命令一个一个删除:

conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge

✅ 二、恢复默认官方源顺序

你也可以直接重设 channel 为默认(官方 Anaconda 源):

conda config --remove-key channels

这会删除所有自定义的 channel 设置,恢复为默认状态。


✅ 三、关闭 show_channel_urls(可选)

如果你开启过频道 URL 显示,也可以关闭它:

conda config --set show_channel_urls no

完成后你可以运行:

conda config --show

确认配置已经被清理或重置。


需要我帮你生成一个一键执行脚本(.sh)来清空所有镜像配置吗?

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐