conda 更新python包速度太慢切换至国内清华镜像

本文介绍了解决Anaconda因官网下载速度慢而导致的更新失败问题的方法。通过配置清华镜像源,可以有效提高下载速度,实现conda环境下Python包的顺利更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

长时间不用python,导致python很多包版本过低,在执行时报错。
可用以下语句一键更新

conda upgrade --all

但是因为anaconda从官网上下载慢,导致报以下错误

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2>
Elapsed: -

解决办法:使用清华镜像链接下载

  1. 依次执行以下四行命令
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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --set show_channel_urls yes
  1. 打开 condarc文件
vim /Users/Zhu/.condarc
ssl_verify: true
channels:
	- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
	- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
	- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
	- defaults         ---------------> 此行需要删除
show_channel_urls: true
  1. 再执行更新命令
conda upgrade --all
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值