近期因工程需要在Ubuntu中使用蓝牙远程一些设备。安装Bluetooth的Python第三方软件包pybluez时遇到很多问题,一番折腾后完美解决。此篇博客进行了梳理和总结,供大家参考。
pip install pybluez
安装pybluez
出现subprocess-exited-with-error
➕metadata-generation-failed
错误pip install pybluez
pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez
安装setuptools
之后,重新执行pip install pybluez
出现subprocess-exited-with-error
➕command 'gcc' failed with exit status 1
错误。原因是因为没有bluetooth/bluetooth.h
这个文件。
通过apt安装bluetooth和libbluetooth-dev,解决因为没有bluetooth/bluetooth.h
这个文件而报的错误。
通过在Github上面直接下载Git仓库然后使用setup.py
代码安装成功。
python setup.py install
pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez
安装成功。直接使用pip
指令安装蓝牙模块pybluez
不容易成功,需要提前安装好libbluetooth-dev
提供pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez
安装。若访问不了GitHub仓库的可以使用网上下载好的代码仓库通过python setup.py install
指令安装。
收集整理和创作不易, 若有帮助, 请帮忙点赞
➕收藏
❤️, 谢谢!✨✨