PyBluez'模块对象没有属性' discover_devices' [英] PyBluez 'module object has no attribute 'discover_devices'
问题描述
我对python还是很陌生,我正试图让Pybluez为我工作.
I'm fairly new to python and I'm trying to get Pybluez to work for me.
当我尝试发现蓝牙设备时,会发生什么.
Here is what happens when i try to discover bluetooth devises.
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
I'm on windows 8.1, python 2.7.10, pybluez 0.21
推荐答案
我也遇到了同样的问题,我在命名程序文件 bluetooth.py
时犯了一个错误,该错误使python的软件包解析混乱,如果是这种情况,您应该注意这个愚蠢的错误.
I had the same problem, I did the mistake of naming my program file bluetooth.py
, which confused python for the package resolution, you should look out for this silly mistake if this is the case .
如果不是这种情况,请尝试将文件放在蓝牙目录(在我的情况下为 C:\ Python27 \ Lib \ site-packages
)所在的目录中,然后运行从那里开始,它对我有用.
If this is not the case then try to put your file in the directory where your bluetooth directory (in my case, C:\Python27\Lib\site-packages
) is located and then run it from there, it worked for me.
这篇关于PyBluez&#39;模块对象没有属性&#39; discover_devices&#39;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!