Running conda with proxy

2020-01-29 03:46发布

I'm using Anaconda 2.7 on windows, and my internet connection uses a proxy.

Previously, when using python 2.7 (Not Anaconda), I installed package like this:

pip install {packagename} --proxy proxy-us.bla.com:123

Is there a way to run conda with proxy argument? didn't see it in conda help.

Thanks

4条回答
太酷不给撩
2楼-- · 2020-01-29 04:10

One mistake I was making was saving the file as a.condarc or b.condarc.

Save it only as .condarc and paste the following code in the file and save the file in your home directory. Make necessary changes to hostname, user etc.

channels:
- defaults

show_channel_urls: True
allow_other_channels: True

proxy_servers:
    http: http://user:pass@hostname:port
    https: http://user:pass@hostname:port


ssl_verify: False
查看更多
forever°为你锁心
3楼-- · 2020-01-29 04:11

You can configure a proxy with conda by adding it to the .condarc, like

proxy_servers:
    http: http://user:pass@corp.com:8080
    https: https://user:pass@corp.com:8080

or set the HTTP_PROXY and HTTPS_PROXY environment variables. Note that in your case you need to add the scheme to the proxy url, like https://proxy-us.bla.com:123.

See http://conda.pydata.org/docs/config.html#configure-conda-for-use-behind-a-proxy-server.

查看更多
Ridiculous、
4楼-- · 2020-01-29 04:20

I was able to get it working without putting in the username and password:

conda config --set proxy_servers.https https://address:port
查看更多
你好瞎i
5楼-- · 2020-01-29 04:35

Or you can use the command line below from version 4.4.x.

conda config --set proxy_servers.http http://id:pw@address:port
conda config --set proxy_servers.https https://id:pw@address:port
查看更多
登录 后发表回答