无法在Python 3(OSX)中导入蓝牙 [英] Cannot import Bluetooth in Python 3 (OSX)

查看:122
本文介绍了无法在Python 3(OSX)中导入蓝牙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于无法使用基本功能,几周前我重新安装了PyBluez.现在,我什至无法将其导入Python 3.

I reinstalled PyBluez some weeks ago since I couldn't get basic functions to work. Now I can't even import it to Python 3.

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项目来安装它.我已尝试对其进行更新,我可以在网上找到有关该问题的所有建议等等.

I was not able to install pybluez via pip/pip3, however I was able to install it by downloading the Github project. I have tried to update it, all suggestions I could find on matter online and much more.

感谢您能提供的任何帮助.

I appreciate any help I can get.

推荐答案

这是GitHub上已关闭的OS X导入问题#108:

This is the closed OS X import issue #108 on GitHub: http://github.com/karulis/pybluez/issues/108

这实际上是一个老问题.您使用的是什么版本?船长?

It's actually quite an old issue. What version are you on? El Captain?

作者建议您做的一件事是删除当前安装并使用pip安装GitHub存储库:

One thing the author suggested you might do is remove your current installation and install the GitHub repo using pip:

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

这似乎可以使导入工作适用于GitHub问题的OP,但是由于对OS X的支持有限,仍然存在一些错误.您可以在GitHub上阅读有关错误和故障排除的更多信息.

That seemed to get the import working for the OP of the GitHub issue, but there were still some bugs due to limited support of OS X. You can read more about the bugs and troubleshooting on GitHub.

这篇关于无法在Python 3(OSX)中导入蓝牙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆