在代理服务器后面使用 ez_setup.py 安装 Python 的 easy_install [英] Installing Python's easy_install using ez_setup.py from behind a proxy server

查看:52
本文介绍了在代理服务器后面使用 ez_setup.py 安装 Python 的 easy_install的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用代理服务器的公司网络上,有没有办法使用 ez_setup.py 安装 Python 的 easy_install?目前,我收到连接超时:

Is there a way to install Python's easy_install using ez_setup.py when on a corporate network that uses a proxy server? Currently, I receive a connection timeout:

Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
Traceback (most recent call last):
  File "C:\jsears\python\ez_setup.py", line 278, in <module>
    main(sys.argv[1:])
  File "C:\jsears\python\ez_setup.py", line 210, in main
    egg = download_setuptools(version, delay=0)
  File "C:\jsears\python\ez_setup.py", line 158, in download_setuptools
    src = urllib2.urlopen(url)
  File "C:\jsears\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\jsears\Python27\lib\urllib2.py", line 400, in open
    response = self._open(req, data)
  File "C:\jsears\Python27\lib\urllib2.py", line 418, in _open
    '_open', req)
  File "C:\jsears\Python27\lib\urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "C:\jsears\Python27\lib\urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "C:\jsears\Python27\lib\urllib2.py", line 1177, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

推荐答案

显然,你可以简单地设置一个环境变量:

Apparently, you can simply set an environment variable:

导出 http_proxy=http://:@:

export http_proxy=http://<user>:<password>@<proxy_host_name>:<port>

例如:

导出 http_proxy=http://admin:password@proxy.example.com:80

export http_proxy=http://admin:password@proxy.example.com:80

这篇关于在代理服务器后面使用 ez_setup.py 安装 Python 的 easy_install的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆