在linux下conda 创建虚拟环境失败的解决方法

报错内容一:

Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/conda-forge/noarch/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=\'conda.anaconda.org\', port=443): Max retries exceeded with url: /conda-forge/noarch/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')])")))'))

解决方法:

切记看好自己的系统是windows还是linux。网上很多方法均是添加镜像源,但是windows和linux是不相同的,不可以直接按照网上增加镜像源。

1)vim ~/.condarc

2)通过i 进入vim编辑模式,添加如下内容:

复制代码
channels:
  - defaults
show_channel_urls: true
default_channels:
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

3)通过 ESC + :wq保存退出

4)重新创建环境 conda create -n xxx python=3.9

报错内容二:

To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.

解决方法:只需要在下包之前输入如下命令就可以了

复制代码
 conda config --add channels conda-forge

执行后执行对应包的安装即可。

相关推荐
STDD4 分钟前
strace 和 perf:Linux 进程调试和性能分析深度指南
linux·运维·php
Rain50911 分钟前
05. mini-cc 工具系统:让 AI 拥有动手能力
linux·前端·人工智能·ubuntu·typescript·ai编程
都在酒里15 分钟前
Linux字符设备驱动开发(五):PWM调光——实现LED亮度控制与呼吸灯效果
linux·运维·驱动开发
Hani_9734 分钟前
Code Coverage系列(三)gcov 是什么?做什么?两个参数?检测原理?gcno文件内容?gcda文件内容?
linux·代码覆盖率
青梅橘子皮38 分钟前
Linux---进程状态与优先级
linux·运维·服务器
H Journey1 小时前
Linux VIM介绍与常用命令
linux·运维·vim
invicinble1 小时前
设计模式(类的拓扑结构)(为什么会产生设计模式,以及什么是设计模式)
linux·服务器·设计模式
Arik~朽木2 小时前
Ubuntu 安装指南
linux·运维·ubuntu
難釋懷2 小时前
Nginx高可用配置
linux·nginx·php
IMPYLH2 小时前
Linux 的 yes 命令
linux·运维·服务器·数据库·bash