macOS Sierra/Python2.7.13 URLError:

2019-09-14 15:45发布

I have been searching/trying everything I could find on Stack Overflow, but no joy. I am new to Python, so I apologize now for my ignorance, but very eager/excited to learn.

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

Here is the error I am receiving:

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条回答
唯我独甜
2楼-- · 2019-09-14 16:27

I had a two fold problem. The steps provided above by @Steffen_Ullrich solved the first half of the issue. Here is the second half, thank you @zwer!

Python and 'print ssl.OPENSSL_VERSION' prints wrong version

查看更多
登录 后发表回答