本文介绍如何使用OpenG中的LabPython模块来将Python引入到LabVIEW中,可以加快LabVIEW的编程。
二、编写写程序,运行报错
注: 在64位的Windows下,python会将32位python27.dll放在C:\Windows\SysWOW64,而不是C:\Windows\System32。
设置完成后,重新运行上一段代码:
LabPython version 4.0.0.4 seems only to work with Python2.7.3/32bit, on Win7/64bit and LabVIEW2011 32bit.
and not with Python3.2.3/32bit. Those are the most recent releases. The 64 bit versions of Python does not work with labVIEW32bit.
The error code is the 1046 "LabVIEW cannot initialize the script server. Ensure the server software is installed."
And a few comments on the vi "PYTHON set Server Path_ogtk.vi": It has a string input which according to the front panel (its missing a help string!) is
possible values : PythonServer
ArrayModule
Why use a string to select between two possible values? A properly crafted enum would be much simpler and less error prone for the user.
The quick help window labels the values for this input as "token (empty: PythonServer)". This is non standard and consequently - misleading syntax. The Empty keeword is implicty (default), so a standard syntax would be
token ("PythonServer")
By the way, the standard python27.dll location seems to be "C:\Windows\SysWOW64\python27.dll" and not C:\Windows\System32\python27.dll. At least in my installation.
五、其他工具包
Python Integration Toolkit
该工具包是收费的,比较好用,兼容Python2.x和3.x,功能比LabPython强大不少。有Home版可以用,但LabVIEW也应该是学生版。
(以上均源自个人研究结果,不当之处,请加以指正。转载请注明出处,谢谢!)