Python PyBluez';模块对象没有属性';发现#u设备';
我对python相当陌生,我正在尝试让Pybluez为我工作 下面是当我试图发现蓝牙设备时发生的情况Python PyBluez';模块对象没有属性';发现#u设备';,python,bluetooth,Python,Bluetooth,我对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 'di
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'
导入蓝牙
附近的_设备=蓝牙。发现_设备()
回溯(最近一次呼叫最后一次):
文件“”,第1行,位于
AttributeError:“模块”对象没有“发现设备”属性
我使用的是windows 8.1、python 2.7.10、pybluez 0.21我也有同样的问题,我犯了一个错误,将我的程序文件命名为bluetooth.py,这让python在软件包解析上感到困惑,如果是这样的话,你应该注意这个愚蠢的错误
如果不是这样,请尝试将文件放在bluetooth目录(在我的例子中是C:\Python27\Lib\site packages)所在的目录中,然后从那里运行它,它对我很有效。我面临同样的问题,因为我使用了我的文件名
bluetooth.py
。因此python无法理解要执行哪个文件。
请重命名您的文件,然后它将工作。将文件重命名为除“bluetooth.py”以外的任何其他名称。太傻了,谢谢。我也将我的文件命名为bluetooth.py。