我想使用Keras.Net在 C# 中运行经过 Python 训练的 ML 模型,但在 Service Fabric 应用程序中执行此操作时遇到问题。我正在主机上运行 Service Fabric 本地群集。我还在这台主机上安装了 python。在主机上的 C# 控制台应用程序中运行 Keras.Net 代码似乎工作正常,但在主机上的 SF 应用程序中运行相同的代码时出现以下错误:
System.AggregateException: One or more errors occurred. (One or more errors occurred. (Unable to load DLL
'python38' or one of its dependencies: The specified module could not be found. (0x8007007E)))
---> System.AggregateException: One or more errors occurred. (Unable to load DLL 'python38' or one of its dependencies: The specified module could not be found. (0x8007007E))
---> System.DllNotFoundException: Unable to load DLL 'python38' or one of its dependencies: The specified module could not be found. (0x8007007E)
at Python.Runtime.Runtime.Py_IsInitialized()
at Python.Runtime.Runtime.Initialize(Boolean initSigs)
at Python.Runtime.PythonEngine.Initialize(IEnumerable1 args, Boolean setSysArgv, Boolean initSigs)
at Python.Runtime.PythonEngine.Initialize(Boolean setSysArgv, Boolean initSigs)
at Python.Runtime.PythonEngine.Initialize()
at Keras.Keras.InstallAndImport(String module)
at Keras.Keras.c.b__27_0()
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy1.CreateValue()
at System.Lazy1.get_Value()
at Keras.Keras.get_Instance()
at Keras.Models.BaseModel.ModelFromJson(String json_string)
这似乎是一个简单的路径问题,但我已经检查过环境在 C# 控制台应用程序以及 SF 应用程序中保持相同的值(在 Visual Studio 中调试时)。
我在这里采取了错误的方法吗?SF 集群节点可以访问主机上的 python 安装吗?
茅侃侃
繁华开满天机
相关分类