使用 pip 安装 faiss-cpu 时出错:在 Python 3.12.0 的 Wheel 构建过程中 swig.exe 命令失败

问题描述 投票:0回答:1

我尝试在 Python 环境中安装

faiss-cpu
包,但在 Wheel 构建过程中遇到与
swig.exe
相关的构建错误。我正在 Windows 上的虚拟环境中工作并使用 Python 3.12.0。

这是我运行时收到的错误消息

pip install faiss-cpu

error: subprocess-exited-with-error

× Building wheel for faiss-cpu (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [details of the error]
swig.exe -python -c++ -Doverride= -I/usr/local/include -Ifaiss -doxygen -DSWIGWIN -module swigfaiss -o faiss\faiss\python\swigfaiss_wrap.cpp faiss\faiss\python\swigfaiss.i
error: command 'swig.exe' failed: None

注意:我注意到有关 pip 的新版本可用的通知。不确定这是否是问题的一部分。

为了排除故障,我尝试了以下操作:

  1. 确保安装了
    swig
    并且
    swig.exe
    的路径位于我系统的PATH环境变量中。在命令提示符下运行
    swig -version
    可正确返回版本。
  2. 我尚未将 pip 和 setuptools 更新到最新版本,但我注意到有关新 pip 版本 (23.3.2) 的通知。
  3. 我尚未检查此软件包是否需要并正确安装 Visual C++ 构建工具。

我希望安装包不会出现任何问题,因为我遵循了标准的 pip 安装程序。我想知道这个问题是否特定于我的 Python 版本 (3.12.0) 或者我系统上的其他配置。

python-3.x windows swig python-3.12
1个回答
0
投票

在当前最新的 faiss-cpu 包 1.7.4 中,他们指定最高为 python 3.11——当降级到该版本时它对我有用。 https://pypi.org/project/faiss-cpu/1.7.4/

© www.soinside.com 2019 - 2024. All rights reserved.