PyVisa开发环境搭建

2025-05-05 18:28:01

1、安装IOLibSuite

2、安装python

3、安装微软常用运行库合集

4、安装pycharm

5、打开windows cmd窗口或cygw坡纠课柩in控制台输入:pip install -U pyvisa等待安装完成

6、采用pycharm建个工程,添加一个python耔阵式肥脚本,脚本内容如下:#!/usr/bin/env pythonimport visafrom pyvisa.resources.usb import USBInstrumentfrom pyvisa.constants import *rm = visa.ResourceManager()res = rm.list_resources()#print rm#print(len(res))if len(res) > 0: # print(res[0]) for dev in res: dev_name = str(dev) if dev_name.startswith("USB"): print("usb resource") usb_res = USBInstrument(rm, dev_name) usb_res.open() #usb_res = rm.open_resource(res[0]) idn = usb_res.query("*IDN?") print(idn) print("over") else: print("other resources")else: print("no dev found")连接示波器设备到pc端,打开iolibsuite,执行python脚本可以看到连接机器的idn字符串

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢