Qu0*_*0rk 11 python linux module bluetooth python-3.x
我试图通过蓝牙将我的联想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")
Run Code Online (Sandbox Code Playgroud)
我收到了错误
Traceback (most recent call last):
File "find_wii.py", line 1, in <module>
import bluetooth
ImportError: No module named 'bluetooth'
Run Code Online (Sandbox Code Playgroud)
我为它安装了bluez和python包装(sudo aptitude install python-bluez
).我升级了我的系统(sudo apt-get update
,sudo apt-get upgrade
).我确实咨询了谷歌,我能找到的唯一官方错误就是这里和这里,这两个答案都不适合我.
如何让蓝牙模块工作?
otu*_*tus 14
您已经安装了bluez绑定的Python 2版本.使用python2
或安装Python 3绑定运行脚本.由于它们没有打包,您需要使用pip安装它们:
python3 -m pip install pybluez
Run Code Online (Sandbox Code Playgroud)
gre*_*ron 13
sudo apt-get install bluetooth libbluetooth-dev
sudo python3 -m pip install pybluez
Run Code Online (Sandbox Code Playgroud)
这对我来说是覆盆子pi 3.
归档时间: |
|
查看次数: |
34075 次 |
最近记录: |