Python ex_setup.py urlopen error [Errno 11004] getaddrinfo failed

て烟熏妆下的殇ゞ 提交于 2019-12-14 02:34:59

问题


I just installed Python on Windows 7 as described on http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/install.html. Im at step 3 and get the following error when I run the python ez_setup.py command. I go the ez_setup.py from this URL http://peak.telecommunity.com/dist/ez_setup.py

c:\Python27>python ez_setup.py
Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-p
y2.7.egg
Traceback (most recent call last):
  File "ez_setup.py", line 278, in <module>
    main(sys.argv[1:])
  File "ez_setup.py", line 210, in main
    egg = download_setuptools(version, delay=0)
  File "ez_setup.py", line 158, in download_setuptools
    src = urllib2.urlopen(url)
  File "c:\Python27\lib\urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "c:\Python27\lib\urllib2.py", line 400, in open
    response = self._open(req, data)
  File "c:\Python27\lib\urllib2.py", line 418, in _open
    '_open', req)
  File "c:\Python27\lib\urllib2.py", line 378, in _call_chain
    result = func(*args)
  File "c:\Python27\lib\urllib2.py", line 1207, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "c:\Python27\lib\urllib2.py", line 1177, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 11004] getaddrinfo failed>

c:\Python27>

回答1:


The answer is in the comment above.

When you are behind a proxy, there is an Windows environment variable which is used to store the proxy setting.

That variable is http_proxy and for secure https_proxy.

The format of setting this variable is below

set http_proxy=user:password@proxyaddress:port
set https_proxy=user:password@proxyaddress:port

If there is no password, then do the following

set http_proxy=user@proxyaddress:port

So an example would be

set http_proxy=jbrown:jbpass@192.168.0.252:8080


来源:https://stackoverflow.com/questions/25917357/python-ex-setup-py-urlopen-error-errno-11004-getaddrinfo-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!