【问题标题】:ImportError: DLL load failed while importing _fblas, when running Python from Visual Studio C# via CFFIImportError:导入 _fblas 时 DLL 加载失败,当通过 CFFI 从 Visual Studio C# 运行 Python 时
【发布时间】:2021-12-21 17:40:52
【问题描述】:

我正在尝试使用 CFFI 从 Visual Studio C# 运行图像处理 Python 脚本。 我已将 Python 脚本 feature-extraction.py 编译到 DLL feature-extraction.dll 中,我通过 P/Invoke 将其包装到 C# 代码中:

[DllImport(@"..\..\feature-extraction.dll", CallingConvention = CallingConvention.Cdecl)]
        static extern void GetFeatures(
            [MarshalAs(UnmanagedType.LPStr)] string path,
            [In, Out, MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] string[] featureNames, 
            [In, Out] float[] featureValues);

调用GetFeatures(path, names, values) 时,出现以下错误:

我重新安装了scikit-image 和scipy(pip install scikit-image,pip install scipy),并将 Pythonwin 和 Python 的 win32\lib 文件夹添加到 PATH,但我仍然遇到这个问题。 我试过pip install blas、pip install _fblas,但它说的是No matching distribution for blas。

我该如何解决这个问题?除了scipy,我还需要安装特定的blas 软件包吗? 提前致谢!

LE:我可以在 anaconda3 提示符下成功运行feature-extraction.py,这让我觉得从 C# 运行时运行时环境存在一些问题

【问题讨论】:

    标签: c# python-3.x scipy blas python-cffi


    【解决方案1】:

    在我使用https://scipy.github.io/devdocs/building/windows.html 中的说明从源重新安装SciPy 后,它起作用了。原来,我必须先安装OpenBLAS,然后再安装Scipy。

    【讨论】:

      猜你喜欢
      • 2020-03-31
      • 2021-07-25
      • 2021-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-12
      • 2020-01-01
      • 2013-12-09
      相关资源
      最近更新 更多