亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 Service Fabric 應用程序中運行 pythonnet (Keras.Net)?

如何在 Service Fabric 應用程序中運行 pythonnet (Keras.Net)?

慕標5832272 2023-10-18 15:21:57
我想使用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 安裝嗎?
查看完整描述

1 回答

?
茅侃侃

TA貢獻1842條經驗 獲得超22個贊

由于 Service Fabric 本地群集在主機上運行虛擬集群,因此在主機上安裝軟件并不自動意味著虛擬集群中的節點可以訪問它們。

為了在 SF 上運行 Python,必須將其安裝在集群本身的節點上。?


查看完整回答
反對 回復 2023-10-18
?
繁華開滿天機

TA貢獻1816條經驗 獲得超4個贊

我建議使用 Docker 容器將應用程序及其先決條件打包在一起,以便它可以在幾乎任何能夠運行容器的主機上運行。

這樣,如果它可以在您的計算機上運行,它也可以在托管集群上運行。它還可以避免在節點上安裝工具的需要,使它們更像“牛”而不是“寵物”。


查看完整回答
反對 回復 2023-10-18
  • 1 回答
  • 0 關注
  • 167 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號