首页 > 解决方案 > '[SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书

问题描述

首要问题:

我正在使用 MackBook Pro 在 PyCharm 中运行连接到 MySQL 的 python3 程序,当我运行收到的程序时

ModuleNotFoundError: No module named 'mysql

对于第 1 行,它是

import mysql.connector

我试过的:

我尝试使用安装mysqlpip

pip3 install mysql-connector-python

新问题:

在执行时

pip install mysql-connector-python

已收到:

Could not fetch URL https://pypi.org/simple/mysql-connector-python/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/mysql-connector-python/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))) - skipping
  Could not find a version that satisfies the requirement mysql-connector-python (from versions: )
No matching distribution found for mysql-connector-python
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))) - skipping" 

标签: pythonmysqlmacospipssl-certificate

解决方案


推荐阅读