macOS Sierra / Python2.7.13 URLError:<urlopen error =“”eof =“”occurrence =“”in =“”violation =“”of =“”protocol =“”(_ssl.c:661)=“”>

时间:2017-07-13 19:30:26

标签: python macos ssl homebrew urlopen

我一直在搜索/尝试Stack Overflow上可以找到的所有东西,但没有快乐。我是Python的新手,所以我为我的无知道歉,但非常渴望/兴奋学习。

macOS Sierra v10.12.5 (early 2011)
Python v2.7.13
urllib==1.21.1
urllib2==1498656401.94
urllib3==1.21.1
Homebrew installed

以下是我收到的错误:

Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 12:39:47) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> 

Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", 
l    ine 154, in urlopen
    return opener.open(url, data, timeout)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", 
line 429, in open
    response = self._open(req, data)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", 
line 447, in _open
    '_open', req)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", 
line 407, in _call_chain
    result = func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", 
line 1241, in https_open
    context=self._context)
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", 
line 1198, in do_open
    raise URLError(err)
URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:661)>
>>>

1 个答案:

答案 0 :(得分:0)

我有两个问题。上述@Steffen_Ullrich提供的步骤解决了问题的前半部分。这是下半场,谢谢@zwer!

Python and 'print ssl.OPENSSL_VERSION' prints wrong version