通过LabPython将Python引入到LabVIEW中_第1页
通过LabPython将Python引入到LabVIEW中_第2页
通过LabPython将Python引入到LabVIEW中_第3页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、通过 LabPython 将 Python 引入到 LabVIEW 中本文介绍如何使用 OpenG 中的 LabPython 模块来将 Python 引入到 LabVIEW 中,可以加快 LabVIEW 的编程。 一、安装环境 通过 VIPM 安装 OpenG 后,即可使用 LabPython 模块。本机运行环境为 Win64 , Python 为 。安装的 LabPython 模块为 ,需要的支持环境为 【This package was tested with Python2.5 on both Windows 7 x86 and Windows XP x86】可以继续使用,只是需要设置一

2、下。二、编写写程序,运行报错程 序在 PYTHON New Session_ogtk.vi 时就报错:error code is the 1046 LabVIEWcannot initialize the script server.Ensure the serversoftware is installed.表明未安装 Python 服务。解决方法如下: 新建一个 VI ,重新设置 Python 的服务路径:注: 在 64 位 的 Windows 下, python 会将 32 位 python27.dll 放在C:WindowsSysWOW64 ,而不是 C:WindowsSystem32

3、设置完成后, 重新运行上一段代码: 以下是 LabPython 作者 关于 1046 错误的解释: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 s

4、tring!) is possible values : PythonServerArrayModule?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 astoken(empty: PythonServer). This is non standard and co

5、nsequently - misleading syntax. The Empty keeword is implicty (default), so a standard syntax would betoken (PythonServer)By the way, the standard python27.dll location seems to be C:WindowsSysWOW64python27.dll只是使用 Python 自带的函数和模块,只需要打包: Pythonxx.dll 即可最好的办法是在目标机器上安装 Python 和需要使用的工具 包,然后在 LabVIEW.ini 文件中设置;增加一行 PythonServer=C:WINDOWSsystem32python27.dll 到LabVIEW.ini 通过以上方法基本可以实现调用 Python 的功 能,实现 Python 在 LabVIEW 中的内嵌运行。 四、使用 Python ScriptNode 在程序中直接编写 Python 语句 借用官方的例程,运行成功!五、其他工具包Python Integration Toolkit该工具包是收费的,比较好用,兼容 Python2.x 和 3.x

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论