pyvisa 打包之后,错误提示:
D:\dwp_backup\python study\communication_instrument_visa\dist>"D:\dwp_backup\python study\communication_instrument_visa\dist\EMI_Test_ok.exe"
Traceback (most recent call last):
? File "EMI_Test_ok.py", line 12, in <module>
ModuleNotFoundError: No module named 'pyvisa'
[63292] Failed to execute script 'EMI_Test_ok' due to unhandled exception!
ValueError: Could not locate a VISA implementation. Install either the IVI binary or pyvisa-py.
[57544] Failed to execute script 'EMI_Test_ok' due to unhandled exception!
解决办法:
06 Jan, 2024?Guides?0 Comments0
The error message you’re encountering indicates that PyVISA is unable to find a VISA implementation on your system. VISA (Virtual Instrument Software Architecture) is a standard for controlling measurement devices such as oscilloscopes and multimeters. PyVISA provides a Python interface for working with VISA.
There are two common VISA implementations for PyVISA: the National Instruments (NI) VISA library and the pyvisa-py library. The error message suggests that neither of these is installed on your system.
Here’s how you can resolve this issue:
bash pip install pyvisa
If you don’t want to use the NI VISA library, you can use the pyvisa-py library, a pure Python implementation of VISA.
bash pip install pyvisa-py
python import visa visa.ResourceManager('@py')
Choose one of the options based on your preference and system compatibility. If you are using Windows and have NI hardware, installing NI-VISA is a common choice. If you want a pure Python solution, go for pyvisa-py.
After installing the appropriate VISA implementation, you should no longer encounter the “ValueError: Could not locate a VISA implementation” error.