在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

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

相关推荐
小义_34 分钟前
【Kubernetes】(五) pod2
linux·云原生·容器·kubernetes
哇哦9821 小时前
渗透安全(渗透防御)②
linux·安全·渗透防御
chao_6666662 小时前
AI coding 代码开发规范
linux·运维·服务器
xiaobangsky2 小时前
Linux SMB/CIFS 网络挂载配置指南
linux·运维·网络
wang09072 小时前
Linux性能优化之内存管理基础知识
java·linux·性能优化
杰 .2 小时前
闲暇时刻对LinuxOS的部分理解(一)
linux·服务器
摩斯电码2 小时前
深入 perf 第二版(二):用原始事件编号解锁 CPU 的隐藏指标
linux·性能优化
代码中介商3 小时前
Linux 基础命令完全指南:从文件操作到进程管理
linux·运维·服务器
思麟呀3 小时前
应用层协议HTTP
linux·服务器·网络·c++·网络协议·http
一个人旅程~3 小时前
linuxmint如何使用iphone手机上网以及如何管理iphone手机的照片和文件?需要下载哪些基础包和依赖?
linux·windows·经验分享·电脑