How to make Anaconda work behind HTTP proxy (not https)?

前端 未结 7 2080
攒了一身酷
攒了一身酷 2020-12-14 18:42

I\'m having trouble working with Anaconda behind a proxy at work.

When I have have the following environment variables:

http_proxy: http://domain\\us         


        
7条回答
  •  我在风中等你
    2020-12-14 19:28

    See my answer in another post:

    The best way I settled with is to set proxy environment variables right before using conda or pip install/update commands. Simply run:

    set HTTP_PROXY=http://username:password@proxy_url:port

    For example, your actual command could be like

    set HTTP_PROXY=http://yourname:your_password@proxy.your_company.com:8080

    If your company uses https proxy, then also

    set HTTPS_PROXY=https://username:password@proxy_url:port

    Once you exit Anaconda prompt then this setting is gone, so your username/password won't be saved after the session.

    I didn't choose other methods mentioned in Anaconda documentation or some other sources, because they all require hardcoding of username/password into

    • Windows environment variables (also this requires restart of Anaconda prompt for the first time)
    • Conda .condarc or .netrc configuration files (also this won't work for PIP)
    • A batch/script file loaded while starting Anaconda prompt (also this might require configuring the path)

    All of these are unsafe and will require constant update later. And if you forget where to update? More troubleshooting will come your way...

提交回复
热议问题