MacPorts Python 2.7.14中的urllib2失败,证书\u VERIFY\u失败

2024-03-28 20:49:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我通过MacOS10.13.3上的MacPorts安装了Python2.7.14。下面的简单脚本对我来说失败了urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)>

from urllib2 import urlopen
urlopen('https://api.github.com/repos/pydata/pandas/issues?per_page=5').read()

不管我用哪个网址。看起来Python可能缺少CA证书。我怎么解决这个问题?在

更新:粘贴下面的openssl输出。在

^{pr2}$

Tags: from脚本sslerrorcertificateurllib2urlopenverify