python - 如何告诉 Python 像 R 的 internet2 选项一样自动使用 Windows XP 中的代理设置?

标签 python proxy

我不是 super 技术人员。但我知道在 Windows 中,如果我使用 internet2 选项安装 R,那么我可以下载我想要的任何包。

我安装了 Python,但每次我尝试下载包或安装包(例如使用 easy_install)时都会失败。

如何让 Python 自动检测我的代理设置并只安装包?

最佳答案

设置环境变量 http_proxy/https_proxyhttp://your-proxy-server-address:proxy-port

The urlopen() function works transparently with proxies which do not require authentication. In a Unix or Windows environment, set the http_proxy, or ftp_proxy environment variables to a URL that identifies the proxy server before starting the Python interpreter. For example (the '%' is the command prompt):

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

The no_proxy environment variable can be used to specify hosts which shouldn’t be reached via proxy; if set, it should be a comma-separated list of hostname suffixes, optionally with :port appended, for example cern.ch,ncsa.uiuc.edu,some.host:8080.

关于python - 如何告诉 Python 像 R 的 internet2 选项一样自动使用 Windows XP 中的代理设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17247981/

相关文章:

node.js - 如何在代理后面配置 node.js (express.js) 应用程序?

Java - 将套接字与代理一起使用

python - python 3 是否在语义上版本化并向前兼容

python - 内置模块的内容如何在不导入 Python 的情况下在全局命名空间中可用?

java - 如何在 Servlet Filter 中从 HttpServletRequest 获取带有参数的 POST URL? (对于代理应用程序)

java - 可以处理 http 和 https 请求的代理服务器 - java

ssl - MITM 代理忽略 Android 应用程序的 SSL 证书验证

扩展 html python Flask 中无法识别 JavaScript onload

Python List直接访问dict

python - 用 python 发送传真?