我正在尝试通过蓝牙将我的联想S10E连接到任天堂Wiimote。我使用的是一个简单的Python脚本,如下所示。我在Linux Mint(版本16,“Petra”)命令行中使用python3 find_wii.py
调用它
脚本:
import bluetooth
target_name = "Nintendo RVL-CNT-01"
target_address = "00:1C:BE:29:75:7F"
nearby_devices = bluetooth.discover_devices()
for bdaddr in nearby_devices:
if target_name == bluetooth.lookup_name( bdaddr ):
target_address = bdaddr
break
if target_address is not None:
print("found target bluetooth device with address "), target_address
else:
print("could not find target bluetooth device nearby")
我收到错误信息
Traceback (most recent call last):
File "find_wii.py", line 1, in <module>
import bluetooth
ImportError: No module named 'bluetooth'
我已经为它安装了bluez和python包装(sudo aptitude install python-bluez
)。我已经升级了我的系统(sudo apt-get update
,sudo apt-get upgrade
)。我确实咨询过谷歌,我唯一能找到的官方错误是here和here,而且这两个答案都不适合我。
如何使蓝牙模块正常工作?
对于Ubuntu 16.04,我也有同样的问题。我安装了pybluez并修复了导入问题。我安装它使用:
您已经安装了Python 2版本的bluez绑定。使用
python2
运行脚本或安装Python 3绑定。由于它们没有打包,您需要使用pip安装它们:这对我来说对覆盆子皮3有效。
相关问题 更多 >
编程相关推荐