【亲测有效】linux conda proxy报错问题解决方法

conda proxy报错问题怎么解决?

报错信息如下:

ProxyError: Conda cannot proceed due to an error in your proxy configuration.

Check for typos and other configuration errors in any ‘.netrc’ file in your home directory,

any environment variables ending in ‘_PROXY’, and any other system-wide proxy

configuration settings.

我的环境

$ uname -v
132~20.04.1-Ubuntu SMP Fri Aug 30 15:50:07 UTC 2024
$ conda --version
conda 24.7.1

系统配置了代理。

问题描述

当执行 $ conda update conda$ conda install numpy时,出现如下错误:

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9958c53680>: Failed to resolve 'http' ([Errno -3] Temporary failure in name resolution)")': /pkgs/r/linux-64/repodata.json.zst

failed

ProxyError: Conda cannot proceed due to an error in your proxy configuration.
Check for typos and other configuration errors in any '.netrc' file in your home directory,
any environment variables ending in '_PROXY', and any other system-wide proxy
configuration settings.

解决方法

步骤1: 清除系统代理,unset掉带_proxy或_PROXY的系统变量

# 找到系统带_proxy或_PROXY的系统变量
env | grep -i "_PROXY"

我的结果如下图:
请添加图片描述

# unset 带_proxy或_PROXY的变量
unset no_proxy
unset https_proxy
unset NO_PROXY
unset HTTPS_PROXY
unset HTTP_PROXY
unset http_proxy

步骤2: 设置conda自带的代理,命令如下:

# 设置conda的代理环境变量
conda config --set proxy_servers.http 192.168.2.9:7890
conda config --set proxy_servers.https 192.168.2.9:7890

注意,很多教程的指令是错误的,多了一个http和https,如下为错误示范

# 错误指令
conda config --set proxy_servers.http http://11.22.33.44:808
conda config --set proxy_servers.https https://11.22.33.44:808
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值