Windows系统Python3.12安装snowflake-connector-python报错求助
在Windows系统上执行以下命令安装Snowflake Python连接器:
pip install snowflake-connector-python
当前Python版本为3.12.0,安装时出现链接错误:
LINK : fatal error LNK1104: cannot open file 'build\temp.win-amd64-cpython-312\Release\src\snowflake\connector\nanoarrow_cpp\ArrowIterator\nanoarrow_arrow_iterator.cp312-win_amd64.exp'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\link.exe' failed with exit code 1104
[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for snowflake-connector-python
Failed to build snowflake-connector-python
ERROR: Could not build wheels for snowflake-connector-python, which is required to install pyproject.toml-based projects
安装预编译wheel包:Python 3.12的snowflake-connector-python本地编译适配存在问题,直接安装兼容的预编译版本,执行:
pip install snowflake-connector-python==3.5.0注:3.5.0及以上版本已支持Python 3.12的预编译wheel,可根据需求选择最新兼容版本。
修复Visual Studio Build Tools配置:若坚持本地编译,确保Visual Studio Build Tools已安装C++桌面开发组件,然后通过对应编译环境执行安装:
- 打开
x64 Native Tools Command Prompt for VS 2022 - 切换到你的Python虚拟环境(如有使用)
- 重新执行
pip install snowflake-connector-python
- 打开
清理pip缓存:缓存损坏可能导致编译失败,清理后重新安装:
pip cache purge pip install snowflake-connector-python通过conda安装:conda包管理会自动处理编译依赖,执行:
conda install -c conda-forge snowflake-connector-python
内容的提问来源于stack exchange,提问作者Vinay Chimmili

