- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在 Win 7 操作系统上运行 Python 2.7.8。我正在尝试通过 PyUSB 与 USB 设备(Numato 32 channel GPIO 设备)通信。
我从 URL 下载了 walac-pyusb-7071ad3:http://walac.github.io/pyusb
我停止接收“ValueError:没有可用的后端”。有哪位 Python 专家能告诉我哪里错了吗?
代码如下:
import sys
import usb
import usb.core
import usb.util
import usb.backend.libusb1
backend = usb.backend.libusb1.get_backend(find_library=lambda C:'\Python27')
numato = usb.core.find(idVendor=00000006,idProduct = 00000000, backend=backend)
这是 Python 错误信息:
Traceback (most recent call last):
File "C:\Python_Yang\PyUSBNumato.py", line 19, in <module>
numato = usb.core.find(idVendor=00000006,idProduct = 00000000, backend=backend)
File "C:\Python_Yang\usb\core.py", line 1199, in find
raise ValueError('No backend available')
ValueError: No backend available
最佳答案
我有同样的错误,但我没有成功使用find_library
(TypeError: get_backend() got an unexpected keyword argument 'find_library'
)。我想,虽然您没有说,但 backend
无效(None
)。
路径 C:\Python27
中是否有 libusb1 实现?我想您没有将它安装在 Python 的文件夹中,如果是这样,这就是您的答案:PyUSB backend not accessible .
否则,如果不使用 find_library
,您必须在 PATH
环境变量中提供 libusb1 实现。我是这样做的(您可以将 os.getcwd()
替换为您的位置):
def get_backend_libusb01():
libusb01_location = os.getcwd()
# load-library (ctypes.util.find_library) workaround: also search the current folder
is_current_folder_in_search_path = True
if None == usb.backend.libusb0.get_backend():
is_current_folder_in_search_path = libusb01_location in os.environ['PATH']
if not is_current_folder_in_search_path:
os.environ['PATH'] += os.pathsep + libusb01_location
backend = usb.backend.libusb0.get_backend()
if not is_current_folder_in_search_path:
os.environ['PATH'] = os.environ['PATH'].replace(os.pathsep + libusb01_location, "")
return backend
关于python - PyUSB 值错误 : No backend available,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25756032/
我正在运行 OS X 10.5 并尝试使用以下代码通过 PyUSB 连接到 USB 设备。 import usb.core, time, usb dev = usb.core.find(i
这个问题在这里已经有了答案: Pyusb on windows - no backend available (12 个答案) 关闭 4 年前。 我正在尝试联系并查找哪些 USB 设备与我的计算机相
我希望我的程序在设备被拔掉时退出。我的代码: device = usb.core.find(idVendor, idProduct) device.detach_kernel_driver(0) us
我有一个通过 USB 连接的设备,我正在使用 pyUSB 连接数据。 这是我的代码目前的样子: import usb.core import usb.util def main(): devi
我正在尝试制作一个脚本(在 Linux 上),它可以打开或关闭鼠标中的灯。 这是我目前的代码: import usb.core import usb.util import sys interface
玩转 PyUSB稍微看看它是否提供了一些关于为什么我正在使用的 WebUSB 库找不到我的设备的见解。我安装了libusb1 on the Mac via Homebrew使用 brew instal
我正在尝试将数字锁定发送到充当 HID 键盘的自定义硬件。我已经绑了一个 LED,如果 USB 上收到数字锁定键,它就会发光。它适用于外部键盘的数字锁定按键。但我无法通过 pyusb 手动发送数字锁定
我正在尝试通过 USB 将我的 Raspberry PI 连接到 Pic4550。 (Pic 功能在 windows c# 程序中是可以的!)。所以我安装了rpi 2,pyusb,并尝试在[https
我在 python 中使用 USB 库。我可以看到设备,我可以配置它。但是当我读出它时,我总是得到相同的东西数组('B',[17、96])。请注意,即使我不写入端点输出,我在读取时仍然会得到相同的结果
我有一个树莓派(我使用的是linux)和一个测量某些值的设备。 我有一个 python 服务器,当客户端发送“我想要这些值”命令时,我会向设备询问一些值。这是我的设备的功能: def usbDevic
我正在 Mac OSX 10.10.5 上使用 python hidapi 访问 USB HID 设备: import hid import time hidraw = hid.device(0x1a
我正在尝试使用 python 库 PyUSB 将数据发送到 USB 内存棒。我使用的代码如下: import usb.core import usb.util # find our devices #
我需要使用 USB 条码阅读器(原始数据模式)读取条码数据。我已经知道我可以将阅读器设置为键盘模式,但这不符合我的要求,因为我将同时使用 4 个阅读器并且文本会重叠。 我是 python 的新手,我尝
嘿,我正在尝试运行教程中可用的简单脚本;。 USB 正在导入,但是当我尝试搜索设备时出现以下错误,请帮忙 >>> dev=usb.core.find() Traceback (most recent
我正在尝试在 Ubuntu 中使用 Honeywell USB 3310g 扫描仪从条形码或二维码输出字符串。我有 libusb 和一个名为 metro-usb ( http://gitorious.
我有一个 Netware uniFlow 设备。当我插入它时,它显示在 dmesg 中: [ 2962.369905] usb 2-1.4: new full-speed USB device num
我试过 this link ,但在 shell 上收到以下消息: sudo apt-get install python-pip : vineet@vineet:~$ sudo pip install
我正在使用带有 PyUSB 的 Dymo USB 秤,除了秤在三分钟后自动关机外,一切都非常好。只要我的 python 程序在运行,我就想让它一直运行。有什么办法可以使用 python 做到这一点吗?
我正在用 Python 编写软件,使用 USB 连接的辐射探测器来探测宇宙 μ 子。 我正在尝试使用 PyUSB 模块与设备交互,但 PyUSB 没有找到我的辐射探测器。设备本身有一个串行端口,但我使
我在 Win 7 操作系统上运行 Python 2.7.8。我正在尝试通过 PyUSB 与 USB 设备(Numato 32 channel GPIO 设备)通信。 我从 URL 下载了 walac-
我是一名优秀的程序员,十分优秀!