[英]Unable to get local issuer certificate mac OS
Running a simple request on Python3.9 on Mac OS BigSur, I'm getting this error:在 Mac OS BigSur 上的 Python3.9 上运行一个简单的请求,我收到了这个错误:
HTTPSConnectionPool(host='store.immediasys.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)'))) HTTPSConnectionPool(host='store.immediasys.com', port=443): url 超过最大重试次数: / (由 SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败: 无法获取本地颁发者证书) _ssl.c:1091)')))
import requests
try:
t = requests.get("https://store.immediasys.com/")
except Exception as e:
pass
I've tried ran the Install Certificates in the Python3.9 folder and I already have certifi installed and updated.我已经尝试在 Python3.9 文件夹中运行安装证书,并且我已经安装和更新了证书。 Any help with this?
有什么帮助吗? It happens on different websites.
它发生在不同的网站上。
The Read Me.rtf for Mac python binaries from python.org states the following:来自 python.org 的 Mac python 二进制文件的 Read Me.rtf 声明如下:
This variant of Python 3.7 includes its own private copy of OpenSSL 1.1.1.
Python 3.7 的这个变体包括它自己的 OpenSSL 1.1.1 的私有副本。 The deprecated Apple-supplied OpenSSL libraries are no longer used.
不再使用已弃用的 Apple 提供的 OpenSSL 库。 This means that the trust certificates in system and user keychains managed by the Keychain Access application and the security command line utility are no longer used as defaults by the Python ssl module.
这意味着由 Keychain Access 应用程序和安全命令行实用程序管理的系统和用户钥匙串中的信任证书不再被 Python ssl 模块用作默认值。 A sample command script is included in /Applications/Python 3.7 to install a curated bundle of default root certificates from the third-party certifi package.
/Applications/Python 3.7 中包含一个示例命令脚本,用于安装来自第三方证书 package 的精选默认根证书包。
I had this problem, too, and after running the script (called Install Certificates.command
), everything worked perfectly and I stopped getting the error.我也遇到了这个问题,在运行脚本(称为
Install Certificates.command
)后,一切正常,我不再收到错误。
Hat tip to @SamBull in the comments for pointing it out.在评论中向@SamBull 致敬以指出这一点。
The certificate of this web-site is signed by Sectigo RSA Organization Validation Secure Server CA
.本网站的证书由
Sectigo RSA Organization Validation Secure Server CA
签署。 Your Python installation misses this certificate.您的 Python 安装缺少此证书。 Download it from Sectigo web site and add to Python certificates.
从Sectigo web 站点下载并添加到 Python 证书。
The path to your certificates: python -m certifi
Just append the downloaded certificate to that file.证书的路径:
python -m certifi
只是 append 下载的证书到该文件。 Please note that you might have to append this certificate to the CRT file each time you update certifi
请注意,每次更新证书时,您可能必须将此证书
certifi
到 CRT 文件中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.