conda报错-Collecting package metadata

conda报错-Collecting package metadata ,第1张

    Anaconda提供了在单机上执行Python / R数据科学和机器学习的最简单方法。有了anaconda帮助管理各种项目运行所需要的环境,就不用担心电脑上的python环境错综复杂带来的抓狂了。

目录
  • 问题描述
  • 问题分析
  • 解决办法
  • 参考
  • conda相关命令

问题描述

    用conda create --name my_virtual_name python=3.8,创建虚拟环境时,出现以下报错

C:\Users\XSF>conda create --name my_virtual_name python=3.8
Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/current_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/cloud/pytorch/win-64'
问题分析

    从输出的描述分析,应该是源的问题。我们可以从换源或者重置源的办法解决。

解决办法

有以下解决办法:

  • 1、重新安装Anaconda

    这种办法非常简单粗暴,常用。如果不删除虚拟环境中的文件,重新安装Anaconda不会影响已配置的虚拟环境。

  • 2、重置或者换源

恢复默认源:

conda config --remove-key channels

换源:
(清华源)

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

(中科大源)

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
参考

https://zhuanlan.zhihu.com/p/123188004

conda相关命令
  • 创建虚拟环境
conda create --name my_virtual_name python=3.8
  • 激活虚拟环境
activate my_virtual_name

  • 退出虚拟环境
conda deactivate

  • 列举已创建的虚拟环境
conda env list
  • 删除虚拟环境
conda remove --name my_virtual_name --all

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/730135.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-27
下一篇 2022-04-27

发表评论

登录后才能评论

评论列表(0条)

保存