下载Python
1. 对于NI TestStand 2021 SP1和2022 Q4,除其他版本外,还支持Python 3.10。
支持的 Python 适配器:
| NI TestStand 版本 | 支持的Python版本 |
|---|
| 2025 Q3 | 3.8、3.9、3.10、3.11、3.12 |
| 2025 Q2 | 3.8、3.9、3.10、3.11、3.12 |
| 2024 Q4 | 3.8、3.9、3.10、3.11、3.12 |
| 2023 Q4 | 3.8、3.9、3.10、3.11 |
| 2022 Q4 | 3.7、3.8、3.9、3.10 |
| 2021 SP1 | 3.6、3.7、3.8、3.9、3.10 |
2. 如果您想选择Python 3.10,请前往Python 3.10下载页面
A:选择与 NI TestStand 相同的 Python 位数。 (有关原因的更多信息,请参阅Using Both LabVIEW 32-Bit and 64-Bit in TestStand - 在这方面,Python 适配器的行为与 LabVIEW 适配器非常相似)
B:下载 Windows 安装程序。
安装Python
1.开始安装
2. 确保选中“Add python.exe to PATH”复选框。为了让 TestStand 找到 Python 解释器,需要将 Python 添加到PATH 环境变量。
3. 选择Customize Installation。

4. 在Advanced Options设置中,
A:为所有用户安装
B:安装在“C:\Program Files”或“C:\Program Files (86)”以外的位置。

在 TestStand 中设置 Python 适配器
1. 在 Teststand 文件菜单中,转到Configure >> Adapters… >> Python >> Configure…
2.选择您安装的Python版本

3. 您可能需要检查Display console for interpreter sessions。
注意:如果您选中“Display console for interpreter sessions” ,则在适配器调用期间将打开控制台窗口,并且将显示 print() 命令。通常建议不要选中此复选框进行部署,因为那样您将需要手动处理控制台弹出窗口。另请记住,不要手动关闭控制台窗口 - 如果这样做,Python 适配器将会崩溃,并且您需要先Unload all modules,然后才能再次使用 Python 适配器。
4. 您可能想使用virtualenv来使用虚拟环境。请参阅知识库文章TestStand's Python Adapter Configuration Shows Invalid Virtual Environment Path以了解更多信息。
有关 Python 适配器配置的更多信息,请参阅NI TestStand Help >> Python Adapter。
完毕。
您已完成 NI TestStand 的 Python 安装。您可以在下面的相关链接部分找到 TestStand 步骤的 Python 示例。