如何摆脱Python 3.11.3中的ssl.SSLCertVerificationError

问题描述 投票:0回答:1

我目前正在学习 IBM 的 Cognitive Class 上的 Python for Data Sciences 课程,并且刚刚开始有关 API 的课程。本课希望我使用 RandomUser API,但每当我尝试使用以下代码访问它时:

from randomuser import RandomUser
r = RandomUser
some_list = r.generate_users(10)

我收到以下错误:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)

我使用的是装有 macOS Venture 13.3.1 的 Macbook Pro,并通过 Homebrew 安装了 Python。

经过几个小时的谷歌搜索和尝试一些东西后,我怀疑这是由于Python在我的Mac操作系统上使用了错误的openssl版本,但我完全不知道如何解决这个问题。

python python-3.x openssl ibm-watson libressl
1个回答
0
投票

这可能与使用 libreSSL 的 MacOS 有关,它拒绝某些 SSL 证书。

尝试安装 OpenSSL 并查看问题是否仍然存在。

© www.soinside.com 2019 - 2024. All rights reserved.