无法在Python 3(OSX)中导入蓝牙



我在几周前重新安装了毕色的,因为我无法获得基本功能。现在我什至无法将其导入Python3。

import bluetooth
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import bluetooth
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyBluez-0.22-py3.6.egg/bluetooth/__init__.py", line 47, in <module>
from .osx import *
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyBluez-0.22-py3.6.egg/bluetooth/osx.py", line 1, in <module>
import lightblue
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/lightblue/__init__.py", line 160, in <module>
from _lightblue import *
ModuleNotFoundError: No module named '_lightblue'

我无法通过PIP/PIP3安装Pybluez,但是我能够通过下载GitHub项目来安装它。我试图对其进行更新,我可以在网上找到所有建议,等等。

我感谢我能得到的任何帮助。

这是github上的封闭式操作系统X导入问题#108:http://github.com/karulis/karulis/pybluez/issues/108

这实际上是一个古老的问题。您在哪个版本?El Captain?

作者建议您可能要做的一件事是删除当前安装,然后使用PIP安装GitHub存储库:

git clone https://github.com/karulis/pybluez.git
pip install -e pybluez

似乎使导入为GitHub问题的OP工作,但是由于OS X的支持有限,仍然存在一些错误。您可以在GitHub上阅读有关错误的更多信息。

最新更新