mac上python连接SSL报错
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host api.binance.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')]
远程ssl连接时出现,比如爬虫等。
这是因为在 Mac 操作系统下,Python 不再使用系统默认的证书,且本身也不提供证书。在进行 HTTPS 请求时,需要使用 certifi 库提供的证书。
解决:python安装目录下点击安装:
Install Certificates.command
cd /Applications/Python\ 3.7/ ./Install\ Certificates.command 或者使用certifi指定证书 pip install certifi