Python 如何在 Windows 上的 http 代理后面使用 easy_install?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18934636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 12:18:09  来源:igfitidea点击:

How to use easy_install behind a http proxy on windows?

pythonproxyeasy-install

提问by yorua007

When I use the command:

当我使用命令时:

easy_install spotter

easy_install spotter

to install the spotterpackage, I got the following error message

要安装该spotter软件包,我收到以下错误消息

Searching for spotter
Reading http://pypi.python.org/simple/spotter/
Download error on http://pypi.python.org/simple/spotter/: [Errno 11001] getaddrinfo      failed -- Some packages may not be found!
Reading http://pypi.python.org/simple/spotter/
Download error on http://pypi.python.org/simple/spotter/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
Couldn't find index page for 'spotter' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Download error on http://pypi.python.org/simple/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
No local packages or download links found for spotter
error: Could not find suitable distribution for Requirement.parse('spotter')

The two environment variables: http_proxyand https_proxyseem not to work?

这两个环境变量:http_proxyhttps_proxy似乎没有工作?

Installing Python's easy_install using ez_setup.py from behind a proxy server

在代理服务器后面使用 ez_setup.py 安装 Python 的 easy_install

回答by Emre Sevin?

Did you try the following:

您是否尝试过以下操作:

$ export http_proxy=http://username:[email protected]:portnumber
$ export https_proxy=https://username:[email protected]:portnumber

And then

进而

$ sudo -E easy_install spotter

I had a problem similar to yours (I'm behind a very restrictive firewall+proxy combination) and the above set of commands and combinations worked for me (in a GNU/Linux environment, particularly Ubuntu).

我遇到了与您类似的问题(我采用了非常严格的防火墙 + 代理组合)并且上述命令和组合对我有用(在 GNU/Linux 环境中,尤其是 Ubuntu)。

回答by user5779971

You have to put your proxy configuration in Internet Explorer and restart your terminal.

您必须将代理配置放入 Internet Explorer 并重新启动终端。

proxy configuration in Internet Explorer

Internet Explorer 中的代理配置

回答by rleelr

From the Windows command prompt, first set the two environment variables:

在 Windows 命令提示符下,首先设置两个环境变量:

c:\> set http_proxy=<user>:<password>@<proxy_ip_address>:<port>
c:\> set https_proxy=<user>:<password>@<proxy_ip_address>:<port>

Then, I was able to run (in the same terminal):

然后,我能够运行(在同一个终端中):

easy_install spotter