【发布时间】:2017-05-24 16:13:53
【问题描述】:
我正在尝试寻找与我的计算机相关联的 USB 设备。我正在阅读“使用 PyUSB 1.0 编程”教程。我无法让我在那里使用的任何东西工作,我不断收到“ValueError:没有可用的背景”错误。我的代码中缺少什么?我在 64 位 Windows 10 机器上。我安装了 libusb1 包和 pylibusb 包。
import usb
import usb.core
import usb.util
import sys
devices = usb.core.find(find_all=True)
sys.stdout.write('There are ' + len(devices) + ' in the system\n.')
【问题讨论】:
-
您使用的是哪个操作系统? Windows 还是 Linux?