How to tell Python to automatically use proxy settings in Windows XP, for example, the R internet2 option?

I am not a super technical person. But I know that on Windows, if I install R using the internet2 option, I can download any package that I need.

I install Python and every time I try to download a package or install a package (for example, using easy_install), it fails.

What can I do to make Python automatically detect my proxy settings and just install packages?

+6
source share
2 answers

Set the http_proxy / https_proxy environment http_proxy to http://your-proxy-server-address:proxy-port

The urlopen () function works transparently with proxies that do not require authentication. On a Unix or Windows environment, set http_proxy or ftp_proxy for the URL that identifies the proxy server before starting the Python interpreter. For example ("%" is the command line):

 % http_proxy="http://www.someproxy.com:3128" % export http_proxy % python ... 

The no_proxy environment variable can be used to indicate hosts that should not be reached through a proxy; if it is installed, it must be a comma-separated list of host name suffixes, optional with: port added, for example, cern.ch, ncsa.uiuc.edu, some.host: 8080.

+8
source

Or use the HTTP_PROXY / HTTPS_PROXY parameter instead.

+1
source

Source: https://habr.com/ru/post/947889/


All Articles