如何修复 PyVISA ValueError: Please install PyUSB to use this resource type

问题:

尝试使用 PyVISA 与 USB 仪器运行 Python 脚本时,你看到以下错误消息:

pyvisa_error.txt
ValueError: Please install PyUSB to use this resource type.
No module named 'usb'

解决方案

在 Ubuntu 等 Linux 发行版上,你可以使用以下命令修复

install_pyusb.sh
sudo apt-get -y install python3-usb

这将安装 Python3 usb 包和 libusb 系统包。


Check out similar posts by category: Python