参考这个文章解决了问题:ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects

以下是我安装的时候,报错:

  Building wheel for hnswlib (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for hnswlib (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'hnswlib' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hnswlib
Failed to build hnswlib
ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects
  1. 首先我在这个网址进行了文件的下载:https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/
    在这里插入图片描述

  2. 下载完成之后,鼠标选中,右键,以管理员身份运行
    在这里插入图片描述

  3. 打开的软件,选择这两个地方:
    在这里插入图片描述

  4. 全部安装完毕,再重新尝试以下命令进行安装:pip install hnswlib

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐