anaconda 创建虚拟环境失败

文章讲述了在配置了国内镜像加速后,使用conda创建环境仍遇到失败的问题,可能原因是conda配置中启用了TLS验证,而服务器不支持证书验证。解决方法包括检查并修改conda配置文件,特别是`ssl_verify`选项,将其设置为`false`来禁用TLS验证,并调整channel顺序,确保使用的是有效的镜像源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

有时候配置了国内加速站,但conda create命令还是失败。可能是conda配置中开启了tls验证,而服务器不支持证书验证。

创建环境报错

conda create -n xxx python==3.10
Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 504 GATEWAY TIME-OUT for url <http://10.155.97.225:8088/repository/conda-proxy/main/linux-64/current_repodata.json>
Elapsed: 00:06.135958

A remote server error occurred when trying to retrieve this URL.

A 500-type error (e.g. 500, 501, 502, 503, etc.) indicates the server failed to
fulfill a valid request.  The problem may be spurious, and will resolve itself if you
try your request again.  If the problem persists, consider notifying the maintainer
of the remote server.

执行命令,发现配置如下:

conda config --show-sources
==> /root/.condarc <==
channel_alias: http://10.155.97.225:8088/repository/conda-proxy
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
default_channels:
  - main
  - r
show_channel_urls: True

编辑文件/etc/conda,做如下操作:

  1. 删除里面的channel_alias
  2. 原本是ssl_verify: true,要设置ssl_verify: false
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
ssl_verify: false
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值