无法安装mysql-connector-python==3.7.3,请求技术支持解决安装问题
执行命令及错误信息
C:\Users\a0229010>python -m pip install mysql-connector-python==3.7.3
Collecting mysql-connector-python3.7.3
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017975C3B5C0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/mysql-connector-python/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017975C3BB38>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/mysql-connector-python/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017975C3B7B8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/mysql-connector-python/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017975C3B438>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/mysql-connector-python/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000017975C3BF60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/mysql-connector-python/
ERROR: Could not find a version that satisfies the requirement mysql-connector-python3.7.3 (from versions: none)
ERROR: No matching distribution found for mysql-connector-python==3.7.3
解决步骤
- 检查网络连接:确认当前网络能正常访问外网,若公司网络有代理限制,可切换至手机热点等无限制网络重试。
- 更换国内pip镜像源:默认PyPI源访问不稳定,使用国内镜像加速安装,执行命令:
python -m pip install mysql-connector-python==3.7.3 -i https://pypi.tuna.tsinghua.edu.cn/simple - 核实版本有效性:mysql-connector-python的3.7系列最高版本为3.7.2,不存在3.7.3版本。若无需指定特定版本,可直接安装最新兼容版本:
python -m pip install mysql-connector-python -i https://pypi.tuna.tsinghua.edu.cn/simple - 本地whl文件安装:若上述方法仍失败,可从国内镜像站下载对应Python版本、系统位数的whl文件(如Python3.8+Windows64位对应
mysql_connector_python-3.7.2-cp38-cp38-win_amd64.whl),然后执行本地安装命令:pip install mysql_connector_python-3.7.2-cp38-cp38-win_amd64.whl
内容的提问来源于stack exchange,提问作者jaypeeee10

