Python-BLE蓝牙套件

2024-06-24 12:25:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我用两个演示代码扫描蓝牙设备。在

1。简单查询示例

import bluetooth

nearby_devices = bluetooth.discover_devices(lookup_names=True)
print("found %d devices" % len(nearby_devices))

for addr, name in nearby_devices:
    print("  %s - %s" % (addr, name))

2。蓝牙低能量扫描

^{pr2}$

1工作正常,但第2个代码显示错误消息。在

File "C:\Python27\Lib\site-packages\bluetooth\ble.py", line 1, in <module>
  from gattlib import *

ImportError: No module named gattlib

如何安装gattlib模块? 谢谢 达伦


Tags: 代码nameinimport示例nameslookupaddr