Linux用conda创建虚拟环境失败报错:Collecting package metadata (current_repodata.json): failed

本文介绍了解决Conda在创建虚拟环境时遇到连接失败的问题。通过更改镜像源到中科大镜像源的方式成功解决了连接错误。适用于遇到类似问题的用户。

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

2021年6月11日 10:57:52

命令为(欲创建一个名为nn的虚拟环境):

conda create -n nn python=3.7

具体报错信息为:

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64'

解决方案:

1、

sudo gedit .condarc

2、输入密码后,将".condarc"修改为:

channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
show_channel_urls: true

(此处我是将原本的清华源修改成了中科大的镜像源。)

3、点击保存(右上角的"save"),点×退出,再使用第一步的命令即可成功创建。

参考博客:

中科大的anaconda镜像源
 

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值