Anaconda创建新环境时报错SSLError

Anaconda创建新环境时报错SSLError

前言

今天给学弟在anaconda上搭建一个pytorch的gpu运行虚拟环境,在创建环境的时候报SSLError的错误(如图)
在这里插入图片描述

解决方案

现有博客大多数是直接通过更改镜像来解决问题,但更改为阿里的镜像后依然报同样的错误(只是报错的url变了),还有一种方法是把现有的镜像删除,恢复原镜像,但是也报错了

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/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.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/pkgs/free/win-64/current_repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

# 更换清华源
conda config --add channels https://mirrors.ustc.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/pkgs/free/
conda config --set show_channel_urls yes
#删除原来的镜像
conda config --remove-key channels

然后找到.condarc文件(目录:“C:\Users\Red-scarf.condarc”),直接替换里面的镜像,并设置ssl_vertify为false,问题解决。

channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true
# 重点是这个false
ssl_verify: false

有些马友的目录下可能没有.condarc文件,创建condarc文件命令:

conda config --add channels r

什么是ssl?
https和ssl分别是什么?有什么关系?

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值