gpt4 book ai didi

python - PyBluez 'module object has no attribute ' discover_devices'

转载 作者:行者123 更新时间:2023-11-28 19:55:04 28 4
gpt4 key购买 nike

我是 python 的新手,我正在尝试让 Pybluez 为我工作。

这是我尝试发现蓝牙设备时发生的情况。

import bluetooth
nearby_devices = bluetooth.discover_devices()

Traceback (most recent call last):
File "<stdin>",line1,in <module>
AttributeError: 'module' object has no attribute 'discover_devices'

我在 windows 8.1、python 2.7.10、pybluez 0.21 上

最佳答案

我遇到了同样的问题,我错误地命名了我的程序文件 bluetooth.py ,这混淆了 python 的包解析,如果是这种情况,你应该注意这个愚蠢的错误.

如果不是这种情况,请尝试将您的文件放在您的蓝牙目录(在我的例子中,C:\Python27\Lib\site-packages)所在的目录中,然后运行它从那里开始,对我有用。

关于python - PyBluez 'module object has no attribute ' discover_devices',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31503884/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com