PyUSB,没有后端可用。如何指定libusb的自定义位置?

2025-09-06 03:20:05 447

系统设置

M1 MacBrew安装libusb /opt/homebrew/Cellar/libusb/1.0.24/lib/libusb-1.0.0.dylibAnacada python 3.10没有后端可用的问题请参阅已知的带有更新的python和基于ARM的Mac的issue。我未能从这一环节找到解决办法。

我希望将libusb的副本放在项目文件夹中,并将其指定为后端。

问题:如何在()中指定libusb-1.0.0.dylib作为自定义后端的位置?

代码语言:javascript运行复制>>> from usb.core import find

>>> f = find(find_all=True)

Traceback (most recent call last):

File "", line 1, in

File "/Users/vincentdavis/opt/anaconda3/envs/py310/lib/python3.10/site-packages/usb/core.py", line 1309, in find

raise NoBackendError('No backend available')

usb.core.NoBackendError: No backend available我应该能够在这个帖子LINK的基础上完成下面的代码。

代码语言:javascript运行复制backend = usb.backend.libusb1.get_backend(find_library="/opt/homebrew/Cellar/libusb/1.0.24/lib/libusb-1.0.0.dylib")

f = find(backend=backend, find_all=True)