我在使用pyvisa模块编写程序,py文件和用pyinstaller -F打包的exe在本机运行都没问题,但是在没有python环境的同操作系统电脑上就不能运行。
import pyvisa as visa
try:
VISA_ADDRESS = 'TCPIP0::192.168.0.99::5025::SOCKET'
rm = visa.ResourceManager()
ena = rm.open_resource(VISA_ADDRESS)
if ena.resource_name.startswith('ASRL') or ena.resource_name.endswith('SOCKET'):
ena.read_termination = '\n'
idn = ena.query("*idn?")
print(idn)
except visa.Error as ex:
print("连接超时")
##以下是在其他电脑用cmd命令行运行后得到的错误提示:
D:>N.exe
Find all devices and interfaces:
Traceback (most recent call last):
File "N.py", line 30, in
File "N.py", line 14, in find
File "pyvisa\highlevel.py", line 3015, in new
File "pyvisa\highlevel.py", line 2924, in open_visa_library
File "pyvisa\highlevel.py", line 2883, in _get_default_wrapper
ValueError: Could not locate a VISA implementation. Install either the IVI binary or pyvisa-py.
[5544] Failed to execute script N
使用pyinstaller -F和-D生成的exe文件都不可运行,感觉是没有正确将pyvisa模块完全打包进exe导致的,但是不知道怎么解决。谢谢大家了
其他电脑还没有安装pyvisa所需的运行环境吧?