VeriStand Python API 無法使用 Python 3.9 或 3.10 安裝: Error:Option --Single-Version-Externally-Managed Not Recognized”

更新 Jan 9, 2025

產品資訊

軟體

  • VeriStand

程式語言

  • Python

問題敘述

我正在嘗試在使用 Python 3.9 或 3.10 時安裝VeriStand Python API
它狀態看起來像是 niveristand,pythonnet。 PyYAML 和 pycparser 都已經下載好,但隨後卻出現錯誤:

Using legacy 'setup.py install' for pythonnet, since 'wheel' is not installed.
Installing collected packages pycparser, PyYAML, pythonnet, niveristand
Running setup.py install for pythonnet ... error
ERROR: Command errored out with exit status 1

此外錯誤消息還指出:

error: option --single-version-externally-managed not recognized

我安裝了 Wheel(pip install -U wheel)並更新了(pip install --upgrade wheel),但錯誤仍然相同。

解決方案

這是使用 Python 3.9 或 3.10 時發生的 pythonnet 的一個已知問題:Pythonnet未安裝在 Python 3.10 · 問題 #1600 · pythonnet/pythonnet · GitHub。

可以使用以下命令解決此問題:

pip install --pre pythonnet

該命令完成後,您可以透過執行正常命令來安裝 Python VeriStand API:

點安裝 niveristand

VeriStand Python 文檔中詳述的任何選項。

相關資訊

如果您希望在離線機器上安裝 Python VeriStand API,則需要安裝以下 packages:

  • PyYAML
  • Pycparser
  • Pythonnet
  • Cffi
  • Clr-loader

確保安裝了wheel ,然後從niveristand · PyPI Download Files 頁面卡下載 Python VeriStand API 源檔案 (.whl)。

安裝軟體包清單後,您可以使用cd命令到剛剛下載的niveristand-2.0.1-py2.py3-none-any.whl檔案,然後執行以下命令:

pip install niveristand-2.0.1-py2.py3-none-any.whl