欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 手游 > 内网anaconda如何使用代理,避免网络连接失败?

内网anaconda如何使用代理,避免网络连接失败?

2025/3/12 3:08:48 来源:https://blog.csdn.net/duoyasong5907/article/details/146161824  浏览:    关键词:内网anaconda如何使用代理,避免网络连接失败?

问题征兆

在内网环境使用anaconda创建新环境:

conda create --name py39 python=3.9

由于网络原因,遇到如下报错:

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffffa9760650>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /anaconda/pkgs/free/linux-aarch64/repodata.json.zstCondaHTTPError: HTTP 000 CONNECTION FAILED for url <http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-aarch64/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.
'http//mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-aarch64'
Platform: linux-aarch64
Collecting package metadata (repodata.json): failedUnavailableInvalidChannel: HTTP 404 NOT FOUND for channel defaults <https://conda.anaconda.org/defaults>The channel is not accessible or is invalid.You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.

解决方法

解决方法是,编辑~/.condarc,粘贴如下内容。其中channels可以替换成其它源,比如清华源、阿里源。

channel_priority: strict
show_channel_urls: true
ssl_verify: false
proxy_servers:http: http://10.58.235.16:3128https: http://10.58.235.16:3128
channels:- https://repo.continuum.io/pkgs/main/- https://repo.continuum.io/pkgs/free/

注意:

  1. 设置proxy_servers,指向你的代理服务器,如有必要填上用户名密码,使用http协议。
  2. 设置ssl_verify: false,避免conda做tls校验导致网络连接失败。这个选项是为了搭配代理IP的http协议一起使用。
  3. 不需要设置channel_alias。
  4. channels属性里删掉defaults、main等项,只保留第三方源。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词