问题描述
我的目标是:在 Win7-PC 上使用 Python 读出 Hantek6022BE USB 示波器,我的 IDE 是 PyCharm。 PC 示波器:http://hantek.com/products/detail/31 该设备已被 PC 正确识别,来自设备管理器的片段: [设备管理器中的 Hantek][1] 我也可以使用 Hantek 提供的软件:转到下载部分,见上面的链接。
我遵循了这些教程: https://pyvisa.readthedocs.io/en/1.8/getting_nivisa.html#getting-nivisa https://hackaday.com/2016/11/16/how-to-control-your-instruments-from-a-computer-its-easier-than-you-think/ http://techforcurious.website/how-to-save-data-from-oscilloscope-using-python-in-linux/
相关主题: https://github.com/pyvisa/pyvisa/issues/453 https://github.com/pyvisa/pyvisa-py/issues/256
我已经安装了这些软件包: [已安装的软件包][2] 签证 PyVisa-py gpib-ctypes pyusb pyserial 运行 python -m visa info 给我以下反馈:
(venv) C:\Users\User\PycharmProjects\pythonProject>python -m visa info
C:\Users\User\PycharmProjects\pythonProject\venv\lib\site-packages\visa.py:13: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace `import visa` by `import pyvisa as visa` to achieve the same effect.
The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
warnings.warn(
C:\Users\User\PycharmProjects\pythonProject\venv\lib\site-packages\gpib_ctypes\gpib\gpib.py:54: UserWarning: GPIB library not found. Please manually load it using _load_lib(filename). All GPIB functions will raise OSError until the lib
rary is manually loaded.
warnings.warn(message)
Machine Details:
Platform ID: Windows-7-6.1.7601-SP1
Processor: Intel64 Family 6 Model 58 Stepping 9,GenuineIntel
Python:
Implementation: cpython
Executable: C:\Users\User\PycharmProjects\pythonProject\venv\Scripts\python.exe
Version: 3.8.6
Compiler: MSC v.1927 64 bit (AMD64)
Bits: 64bit
Build: Sep 23 2020 15:52:53 (#tags/v3.8.6:db45529)
Unicode: UCS4
PyVISA Version: 1.11.3
Backends:
ivi:
Version: 1.11.3 (bundled with PyVISA)
Binary library: Not found
py:
Version: 0.5.1
ASRL INSTR: Available via PySerial (3.5)
USB INSTR:
PyUSB does not seem to be properly installed.
Please refer to PyUSB documentation and
install a suitable backend like
libusb 0.1,libusb 1.0,libusbx,libusb-win32 or OpenUSB.
No backend available
USB RAW:
PyUSB does not seem to be properly installed.
Please refer to PyUSB documentation and
install a suitable backend like
libusb 0.1,libusb-win32 or OpenUSB.
No backend available
TCPIP INSTR: Available
TCPIP SOCKET: Available
正如此处 pyvisa 页面上的建议,我尝试安装适当的后端,因为信息输出引发了一些错误。安装时间相对较长,大约 40 分钟。
安装后,找到后端:
(venv) C:\Users\User\PycharmProjects\pythonProject>python -m visa info
C:\Users\User\PycharmProjects\pythonProject\venv\lib\site-packages\visa.py:13: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace `import visa` by `import pyvisa as visa` to achieve the same effect.
The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
warnings.warn(
C:\Users\User\PycharmProjects\pythonProject\venv\lib\site-packages\gpib_ctypes\gpib\gpib.py:54: UserWarning: GPIB library not found. Please manually load it using _load_lib(filename). All GPIB functions will raise OSError until the lib
rary is manually loaded.
warnings.warn(message)
Machine Details:
Platform ID: Windows-7-6.1.7601-SP1
Processor: Intel64 Family 6 Model 58 Stepping 9,GenuineIntel
Python:
Implementation: cpython
Executable: C:\Users\User\PycharmProjects\pythonProject\venv\Scripts\python.exe
Version: 3.8.6
Compiler: MSC v.1927 64 bit (AMD64)
Bits: 64bit
Build: Sep 23 2020 15:52:53 (#tags/v3.8.6:db45529)
Unicode: UCS4
PyVISA Version: 1.11.3
Backends:
ivi:
Version: 1.11.3 (bundled with PyVISA)
#1: C:\Windows\system32\visa32.dll:
found by: auto
bitness: 64
vendor: National Instruments
Impl. Version: National Instruments
Spec. Version: National Instruments
#2: C:\Windows\system32\visa64.dll:
found by: auto
bitness: 64
vendor: National Instruments
Impl. Version: National Instruments
Spec. Version: National Instruments
py:
Version: 0.5.1
ASRL INSTR: Available via PySerial (3.5)
USB INSTR:
PyUSB does not seem to be properly installed.
Please refer to PyUSB documentation and
install a suitable backend like
libusb 0.1,libusb-win32 or OpenUSB.
No backend available
TCPIP INSTR: Available
TCPIP SOCKET: Available
但我仍然看不到 PC 示波器。 编辑:我测试了以下代码:
import pyvisa as visa
rm = visa.ResourceManager()
rm.list_resources()
print(rm.list_resources())
OUTPUT:
C:\Users\User\PycharmProjects\pythonProject\venv\Scripts\python.exe C:/Users/User/PycharmProjects/pythonProject/visatest.py
('ASRL1::INSTR',)
Process finished with exit code 0
谢谢! [1]:https://i.stack.imgur.com/fm3HE.png [2]:https://i.stack.imgur.com/dUcjh.png
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)