0
我的系統上安裝了Python 2和Python 3。nxt-python錯誤:usb.core.NoBackendError
我運行下面的腳本:
#!/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 2中,如預期python spin.py
。
然而,當我運行此命令,我得到以下錯誤:
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
當我運行此腳本通過USB我的NXT插入我的電腦,我的NXT上。另外,我已經安裝了pyUSB(正確的,我認爲)。
爲什麼會發生此錯誤?