【发布时间】: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