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

安装chroma-hnswlib遇LNK1104错误:无法打开kernel32.lib求助

解决pip install chroma-hnswlib时LNK1104无法打开kernel32.lib的问题

执行pip install chroma-hnswlib安装库时失败,触发LNK1104错误,提示无法打开文件'kernel32.lib',错误日志如下:

"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\soft-engg-project-may-2024-se-may-22-main\venv\libs /LIBPATH:C:\Users\naveen\AppData\Local\Programs\Python\Python313\libs /LIBPATH:C:\Users\naveen\AppData\Local\Programs\Python\Python313 /LIBPATH:D:\soft-engg-project-may-2024-se-may-22-main\venv\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.42.34433\lib\x64" /EXPORT:PyInit_hnswlib build\temp.win-amd64-cpython-313\Release\./python_bindings/bindings.obj /OUT:build\lib.win-amd64-cpython-313\hnswlib.cp313-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-313\Release\./python_bindings\hnswlib.cp313-win_amd64.lib
      LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.42.34433\\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 chroma-hnswlib
Failed to build chroma-hnswlib
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (chroma-hnswlib)

解决方法

  • 检查Windows SDK安装情况:打开Visual Studio Installer,选择已安装的「Visual Studio Build Tools 2022」,点击「修改」,确保勾选对应Windows版本的Windows SDK(比如Windows 11 SDK),完成安装后重启终端重试。
  • 配置LIB环境变量:确认系统环境变量LIB包含kernel32.lib的路径,通常路径为C:\Program Files (x86)\Windows Kits\10\Lib\<SDK版本号>\um\x64(x64对应你的系统架构),若缺失则手动添加该路径。
  • 使用预编译轮子:忽略编译过程,直接下载对应Python版本、系统架构的chroma-hnswlib预编译.whl文件,执行pip install <文件名>.whl完成安装。
  • 修复Build Tools:打开Visual Studio Installer,选择「Visual Studio Build Tools 2022」,点击「修复」,修复可能损坏的组件或路径配置。

内容的提问来源于stack exchange,提问作者NAVEEN .K

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 01:00:10