2014-09-18 184 views
1

我剛剛在Windows 7上安裝了Python,如 http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/install.html中所述。 在步驟3的Im,當我運行python ez_setup.py命令時出現以下錯誤。 我去ez_setup.py從這個URL http://peak.telecommunity.com/dist/ez_setup.pyPython ex_setup.py urlopen錯誤[Errno 11004] getaddrinfo失敗

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> 
+0

我發現問題解決問題。 這是由於可以使用以下命令修復的網絡代理。 'set http_proxy = user:password @ proxyaddress:port'。 我希望這可以幫助某人 – 2014-09-18 18:45:59

回答

1

答案是在上面的評論。

當您位於代理的後面時,會有一個Windows環境變量用於存儲代理設置。

該變量是http_proxy和安全https_proxy

設置這個變量的格式是如下

set http_proxy=user:[email protected]:port 
set https_proxy=user:[email protected]:port 

如果沒有密碼,然後執行以下操作

set [email protected]:port 

因此,一個例子是

set http_proxy=jbrown:[email protected]:8080 
相關問題