栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Anaconda创建新环境时报错SSLError

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Anaconda创建新环境时报错SSLError

Anaconda创建新环境时报错SSLError
  • 前言
    • 解决方案

前言

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

解决方案

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

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 ConNECTION FAILED for url 
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:UsersRed-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分别是什么?有什么关系?

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/329180.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号