How to configure PIP per config file to use a proxy (with authentification)?

后端 未结 4 1800
灰色年华
灰色年华 2021-02-01 08:29

I used to set up environment evariables http_proxy and https_proxy (with user + password) in the past to use Pip (on Windows) behind a corporate proxy. But recently I needed to

4条回答
  •  再見小時候
    2021-02-01 09:28

    If package that you are trying to install has dependencies it's best to create pip.ini for system wide configuration, in windows you can do this in powershell:

    mkdir c:\programdata\pip\
    new-item c:\programdata\pip\pip.ini
    

    and add this to your pip.ini

    [global]
    proxy = http://domain\user:pwd@proxy_hostname_or_ip:port 
    

    and then everything should work fine, as HTTP_PROXY variable didn't work for me.

    Make sure to save file as ansi or windows1252 in VSCode as UTF files are not read properly.

提交回复
热议问题