简体   繁体   English

windows 导入 faiss 错误:DLL 加载失败

[英]windows import faiss error:DLL load failed

I install faiss-cpu form pypi.org我从pypi.org安装 faiss-cpu

But when I use this code:但是当我使用这段代码时:

import faiss

the error message is:错误信息是:

ImportError                               Traceback (most recent call last)
~\Anaconda3\lib\site-packages\faiss\loader.py in <module>
     33         logger.info("Loading faiss.")
---> 34         from .swigfaiss import *
     35 

~\Anaconda3\lib\site-packages\faiss\swigfaiss.py in <module>
     12 if __package__ or "." in __name__:
---> 13     from . import _swigfaiss
     14 else:

ImportError: DLL load failed: The specified module could not be found.

How to fix it?如何解决?

If you have installed faiss using pip.如果您使用 pip 安装了 faiss。 Then use然后使用

conda install -c conda-forge faiss conda install -c conda-forge faiss

In anaconda prompt.在 anaconda 提示符下。

The faiss on PyPi is, according to the project description , It says根据项目描述,PyPi 的 faiss 是,它说

an Unofficial prebuilt binary for Linux and MacOS. Linux 和 MacOS 的非官方预构建二进制文件。

It seems you have to switch to Linux or MacOS to run it.看来您必须切换到 Linux 或 MacOS 才能运行它。 But you are running on windows, which is not supported.但是您在 windows 上运行,这是不受支持的。 You can read the official installation instructions for Faiss .您可以阅读Faiss 的官方安装说明

Add your DLL location of python (C:\Program Files\Python<version.no>\DLLs) in Environment variables of Path在路径的环境变量中添加 python (C:\Program Files\Python<version.no>\DLLs) 的 DLL 位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM