首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >nxt错误: usb.core.NoBackendError

nxt错误: usb.core.NoBackendError
EN

Stack Overflow用户
提问于 2016-12-24 03:35:32
回答 1查看 939关注 0票数 0

我的系统上安装了Python 2和Python 3。

我运行以下脚本:

代码语言:javascript
复制
#!/usr/bin/env python

import nxt.locator
from nxt.motor import *

def spin_around(b):
    m_left = Motor(b, PORT_B)
    m_left.turn(100, 360)
    m_right = Motor(b, PORT_C)
    m_right.turn(-100, 360)

b = nxt.locator.find_one_brick()
spin_around(b)

使用命令:python spin.py,它按照预期使用Python2。

然而,当我运行这个命令时,我会得到以下错误:

代码语言:javascript
复制
Traceback (most recent call last):
  File "spin.py", line 12, in <module>
    b = nxt.locator.find_one_brick()
  File "/Library/Python/2.7/site-packages/nxt/locator.py", line 112, in find_one_brick
    for s in find_bricks(host, name, silent, method):
  File "/Library/Python/2.7/site-packages/nxt/locator.py", line 43, in find_bricks
    for s in socks:
  File "/Library/Python/2.7/site-packages/nxt/usbsock.py", line 84, in find_bricks
    for bus in usb.busses():
  File "/Library/Python/2.7/site-packages/usb/legacy.py", line 353, in busses
    sorted(core.find(find_all=True), key=lambda d: d.bus),
  File "/Library/Python/2.7/site-packages/usb/core.py", line 1263, in find
    raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available

当我运行这个脚本时,我的NXT是通过USB插入到我的计算机上的,我的NXT是打开的。此外,我已经安装了pyUSB (我认为是正确的)。

为什么会发生这样的错误?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-24 15:12:42

解决方案是安装libUSB。pyUSB库在后台似乎依赖于libUSB。

我在libUSB中安装了brew install libusb

之后,这个特定的错误被修复了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41310102

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档