在 conda 中使用代理

Using a proxy with conda

我需要配置代理才能在 Anaconda 中升级我的 Python 环境。我指定了 HTTP_PROXY 环境变量:

set HTTP_PROXY=myproxy:8080

并修改了C:\Users\I328807中的.condarc文件:

proxy_servers:
    http: http://myproxy:8080

但 conda 仍然无法连接:

C:\Users\I328807>conda install python=3.5
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: Could not connect to https://repo.continuum.io/pkgs/free/win-64/
Could not connect to https://repo.continuum.io/pkgs/free/noarch/
Could not connect to https://repo.continuum.io/pkgs/pro/win-64/
Could not connect to https://repo.continuum.io/pkgs/pro/noarch/

请你重试:

export HTTP_PROXY 而不是设置。

sudo -E bash -c 'echo $HTTP_PROXY' 确保导出变量。

否则请注意,在您的 .condarc 中,您不能在 http: 和声明之间使用制表符,只能使用 space.

尝试使用 HTTPS 代理,而不是 HTTP。

所以配置应该是,

set HTTPS_PROXY=myproxy:8080

proxy_servers:
    https: https://myproxy:8080

有关详细信息,请参阅此处: http://conda.pydata.org/docs/config.html#configure-conda-for-use-behind-a-proxy-server-proxy-servers