Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python蓝牙编译器错误_Python_Bluetooth Lowenergy - Fatal编程技术网

Python蓝牙编译器错误

Python蓝牙编译器错误,python,bluetooth-lowenergy,Python,Bluetooth Lowenergy,我使用两个演示ode扫描蓝牙设备 1.简单查询示例 2.蓝牙低能量扫描 1运行良好,但第2个代码显示错误消息 File "C:\Python27\Lib\site-packages\bluetooth\ble.py", line 1, in <module> from gattlib import * ImportError: No module named gattlib 文件“C:\Python27\Lib\site packages\bluetoot

我使用两个演示ode扫描蓝牙设备

1.简单查询示例 2.蓝牙低能量扫描 1运行良好,但第2个代码显示错误消息

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

ImportError: No module named gattlib
文件“C:\Python27\Lib\site packages\bluetooth\ble.py”,第1行,在
从gattlib进口*
ImportError:没有名为gattlib的模块
如何安装gattlib模块? 谢谢
Darren

你是想用python2还是python3来做这件事?你试过pip和/或apt get吗?你是想用python2还是python3来做这件事?你试过pip和/或apt get吗?
from bluetooth.ble import DiscoveryService

service = DiscoveryService()
devices = service.discover(2)

for address, name in devices.items():
    print("name: {}, address: {}".format(name, address))
File "C:\Python27\Lib\site-packages\bluetooth\ble.py", line 1, in <module>
  from gattlib import *

ImportError: No module named gattlib