To use pip behind a proxy, you can specify the proxy with the --proxy
option.
pip install --proxy=https://user:pass@server:port packages
If you're going to do several pip installs in a given session, you can set your proxy variables in the terminal or command prompt. The lines below are taken from here. If you have the ability to define the environmental varibles, do that once and you should be good to go.
# Windows
set http_proxy=http://[username:password@]proxyserver:port
set http_proxy=https://[username:password@]proxyserver:port
# Linux
export https_proxy=https://[username:password@]proxyserver:port
At work, we still had some issues because some domains were not trusted, so you can add the following lines to tell pip that the following domains are okay.
--trusted-host pypi.python.org
--trusted-host files.pythonhosted.org
--trusted-host pypi.org
If you want to set up Anaconda to use the proxy without having to specify the proxy each time, you need to create a .condarc
file in your home directory. Add the following lines to the .condarc
file and you should be good to go. More information can be found here.
proxy_servers:
http: http://user:pass@server:port
https: https://user:pass@server:port
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…