One - One Code All

Blog Content

mac上python连接SSL报错certificate verify failed: unable to get local issuer certificate _ssl.c:1123

Python Linux-Mac   2019-04-13 14:29:33

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



上一篇:python pandas的dataframe有条件滚动计数连续计数cumsum
下一篇:mac python查找第三方库路径site-packages

The minute you think of giving up, think of the reason why you held on so long.