Scadao 发表于 2018-11-13 13:31:33

Python的调用

LabVIEW 2018 引入了Python节点,它提供了从LabVIEW块图中直观地调用Python脚本的本地能力。它使用LabVIEW原语,提供了一种在低延迟的语言之间进行互操作的方法。仅支持版本为2.7和3.6的Python。

http://zone.ni.com/images/reference/en-XX/help/371361R-01/open_python_session.gif http://zone.ni.com/images/reference/en-XX/help/371361R-01/python_node.gif http://zone.ni.com/images/reference/en-XX/help/371361R-01/close_python_session.gif

对于Python的更高级使用,包括类方法支持、调试、部署Python解释器和包依赖性,我们建议使用Enthought公司的Python Integration Toolkit for LabVIEW。通过环境之间的快速双向通信,您的LabVIEW项目可以从Python生态系统中的数千个成熟的、经过良好测试的软件包中受益。快速有效地访问用于信号处理、机器学习、图像分析、数据导入/导出等的科学和工程工具。由于Python端只有极少的编码,这个非常简单的接口提供了对Python所有功能的访问。

https://www.enthought.com/wp-content/uploads/2017/03/python-integration-tool-2.png

Scadao 发表于 2019-1-7 11:47:55

Python接口实战

https://ni.i.lithium.com/t5/image/serverpage/image-id/233838i8EA8A464B5A3B8CC/image-size/large?v=1.0&px=999

Scadao 发表于 2019-1-8 13:14:03

上楼链接中有段涉及库安装编译通不过的问题,解决办法:

After a long time of research, I found the solution :
1. in the command prompt write "cd C:\Users\user\AppData\Python36-32\Scripts" so all the other command will occur in this folder.
2. type "pip install numpy" and the other libraries that you want. I installed matplotlib, scipy, scikit-learn, pillow, pandas, tensorflow (compatible just with Python 64bits) and keras.
After these steps you will be able to run the codes which use your libraries.

Scadao 发表于 2019-1-8 14:30:39

据NI网友经验,Python节点的调用如超过3.6.7以上则编译出错:

3.6.6 also works.3.6.7 doesn't work.3.6.8 doesn't work.
https://ni.i.lithium.com/t5/image/serverpage/image-id/240253i4CA1850266A7DC5F/image-size/large?v=1.0&px=999

Scadao 发表于 2019-1-11 17:59:39

这几天设置环境编译运行调用Python节点通过的经验如下:

无论Windows7还是Windows10的32位或64位操作系统,均无所谓,但跟LabVIEW2018的版本有关,32位的测试通过,64位没测试成功过。测试选用的Python官网的Python3.6.0版本,默认路径安装。

Scadao 发表于 2019-1-11 19:27:30

在如下路径安装numpy和matplotlib:C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Scripts
运行链接第12条信息中例程,成功截图如下:
https://ni.i.lithium.com/t5/image/serverpage/image-id/240609i818C9D28312FC8DC/image-size/medium?v=1.0&px=400调用Python函数

Scadao 发表于 2019-3-19 11:50:13

在LabVIEW中调用Python




Scadao 发表于 2019-8-19 22:56:11

NIWeek2019关于LabVIEW与Python互动的讲解PPT文档


页: [1]
查看完整版本: Python的调用