PyBluez无法检测内置蓝牙适配器
我想开始开发一些工具,让我的手机和电脑通过蓝牙进行通信,我想用Python来实现这个功能。我安装了Python的蓝牙模块(PyBluez),但是它没有检测到我电脑内置的蓝牙适配器(我用的是东芝Satellite A300)。
import bluetooth
nearby_devices = bluetooth.discover_devices()
print(nearby_devices)
返回了以下错误:
Traceback (most recent call last):
File "C:/Python26/bt.py", line 3, in <module>
nearby_devices = bluetooth.discover_devices()
File "C:\Python26\lib\site-packages\bluetooth\msbt.py", line 9, in discover_devices
return bt.discover_devices (flush_cache, lookup_names)
IOError: No Bluetooth adapter detected
有人能帮忙吗?
2 个回答
1
你可以尝试卸载这个驱动程序(如果可以的话),然后重启你的Windows系统,让它自动安装默认的驱动程序。这样做的话,PyBluez会运行得更顺畅。
2
PyBluez这个库在Windows上使用的是微软的蓝牙驱动程序和Widcom,而在Linux上则使用BlueZ。如果你的笔记本电脑使用的是其他的蓝牙驱动程序,那它可能就无法正常工作,这是很正常的情况。