SystemLink Analysis Automation 中發生找不到 Python 模組的錯誤

更新 Jan 9, 2025

產品資訊

軟體

  • SystemLink Server
  • SystemLink TDM Analysis Add-On

程式語言

  • Python

問題敘述

  • 我在 DIAdem 中建立了一個Analysis Automation Procedure  (分析自動化流程 .ANP 檔案),用於匯入外部 Python 模組。腳本在 DIAdem 中運作良好,但是當我從 SystemLink 執行 ANP 時,我收到一個系統錯誤,指出ModuleNotFoundError
  • 當我使用 Python 程式碼執行 ANP 時,我的 SystemLink Analysis Server 顯示以下錯誤。


An error has occurred while executing a Python script: Traceback (most recent call last): <traceback calls>, in On_Run_AnalysisProcedure from <module name> import <function> ModuleNotFoundHere: No module named '<module name>' 

ANP 模組未找到錯誤.PNG

解決方案

當 SystemLink 伺服器未安裝必要的 Python 模組時,分析自動化流程(.ANP 檔案)會出現此錯誤。
請依照以下步驟解決此錯誤:

  1. 從 SystemLink Web 應用程式中,開啟 Utilities >> Jupyter  。
    • 如果沒有 Jupyter 這個選項出現,請確認 NI SystemLink Server - JupyterHub Module 已安裝在 NI Package Manager 中,並且 NI SystemLink Server Configuration 應用程式中的所有服務都在執行。
  2. 點選File >> New >> Notebook建立新的 Jupyter Notebook。
    • 確保所選kernel  是Python 3
  3. 在程式碼單元中,輸入!pip install <module> ,其中<module>是錯誤中報告的缺失模組的名稱。
  4. 執行筆記本。

安裝 fpdf Jupyter.PNG

  1. 在 SystemLink 中重新執行分析自動化流程。