我正在尝试使用 pyusb 和 pyusb-keyboard-a-like 接管条形码扫描仪。我有一个运行win7的系统。我已经安装了带有libusb-win32
过滤器和 inf-wizard 的 USB 驱动程序。我的代码如下所示:
from keyboard_alike import reader
class BarCodeReader(reader.Reader):
pass
if __name__ == "__main__":
reader = BarCodeReader(0x0c2e, 0x0b41, 84, 6, should_reset=False)
reader.initialize()
print(reader.read().strip())
reader.disconnect()
并给我以下错误:
Traceback (most recent call last):
File "C:\Users\Alexander\Downloads\pyusb-keyboard-alike-master\pyusb-keyboard-alike-master\lindy_bar_code_scanner.py", line 14, in <module>
reader.initialize()
File "C:\Users\Alexander\Downloads\pyusb-keyboard-alike-master\pyusb-keyboard-alike-master\keyboard_alike\reader.py", line 37, in initialize
self._device = usb.core.find(idVendor=self.vendor_id, idProduct=self.product_id)
File "C:\Python27\lib\site-packages\usb\core.py", line 846, in find
raise ValueError('No backend available')
ValueError: No backend available
我该如何解决这个错误?