You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows11下Python3.12无法安装cloud-sql-python-connector求解决方案

解决Python 3.12下安装cloud-sql-python-connector失败的问题

核心原因

安装失败并非cloud-sql-python-connector本身不兼容Python 3.12,而是其依赖的frozenlist和multidict需要编译C扩展,你的环境缺少Microsoft Visual C++ 14.0及以上编译工具,导致无法构建这两个依赖的wheel包。

可行解决方案

1. 安装Microsoft C++ Build Tools

直接补充编译所需的工具链:

  • 卸载系统中已有的旧版Visual C++ Build Tools(若存在)
  • 运行Microsoft C++ Build Tools安装程序,选择「Desktop development with C++」工作负载,确保勾选以下组件:
    • MSVC v143 - VS 2022 C++ x64/x86 build tools
    • 对应系统版本的Windows SDK(如Windows 11 SDK)
    • C++ CMake tools for Windows
  • 安装完成后重启终端,重新执行pip install -r requirements.txt

2. 指定依赖的预编译版本(推荐)

不想安装编译工具的话,可在requirements.txt中指定frozenlist和multidict的兼容版本,这些版本已提供Python 3.12的预编译wheel:

cloud-sql-python-connector
flask
flask-cors
google-api-python-client
google-cloud-secret-manager
jira
matplotlib
numpy
PyYAML
python-pptx
pg8000
sqlalchemy
python-dateutil
Pillow
requests
# 添加兼容Python3.12的预编译版本
frozenlist>=1.4.1
multidict>=6.0.5

之后执行pip install -r requirements.txt即可。

3. 强制使用预编译包

执行安装命令时添加参数,强制pip优先使用预编译wheel,跳过源码编译步骤:

pip install cloud-sql-python-connector --only-binary :all:

若要安装整个requirements.txt的依赖:

pip install -r requirements.txt --only-binary :all:

内容的提问来源于stack exchange,提问作者Europa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 23:48:12