Ubuntu安装蓝牙模块pybluez以及问题解决方案【完美解决】

简介

近期因工程需要在Ubuntu中使用蓝牙远程一些设备。安装Bluetooth的Python第三方软件包pybluez时遇到很多问题,一番折腾后完美解决。此篇博客进行了梳理和总结,供大家参考。

问题及解决办法

  • pip install pybluez安装pybluez出现subprocess-exited-with-errormetadata-generation-failed错误
pip install pybluez

在这里插入图片描述

  • 尝试使用GitHub的渠道进行安装,仍不成功。
pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez

在这里插入图片描述

  • 安装setuptools之后,重新执行pip install pybluez出现subprocess-exited-with-errorcommand 'gcc' failed with exit status 1 错误。原因是因为没有bluetooth/bluetooth.h这个文件。
    在这里插入图片描述

  • 通过apt安装bluetooth和libbluetooth-dev,解决因为没有bluetooth/bluetooth.h这个文件而报的错误。
    在这里插入图片描述
    在这里插入图片描述

  • 通过在Github上面直接下载Git仓库然后使用setup.py代码安装成功。🚀🚀

python setup.py install

在这里插入图片描述

  • 尝试在另一个Python环境中使用pip命令直接安装出现错误,安装2to3之后仍不成功,直接使用pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez安装成功。🚀🚀🚀

在这里插入图片描述

总结

直接使用pip指令安装蓝牙模块pybluez不容易成功,需要提前安装好libbluetooth-dev提供<bluetooth/bluetooth.h>头文件。然后使用pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez安装。若访问不了GitHub仓库的可以使用网上下载好的代码仓库通过python setup.py install指令安装。


收集整理和创作不易, 若有帮助🉑, 请帮忙点赞👍➕收藏❤️, 谢谢!✨✨🚀🚀

相关推荐

  1. Windows 无法连接 解决方案

    2023-12-17 05:08:04       36 阅读
  2. 芯片智能秤解决方案

    2023-12-17 05:08:04       22 阅读
  3. ubuntu连接问题

    2023-12-17 05:08:04       34 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-17 05:08:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-17 05:08:04       100 阅读
  3. 在Django里面运行非项目文件

    2023-12-17 05:08:04       82 阅读
  4. Python语言-面向对象

    2023-12-17 05:08:04       91 阅读

热门阅读

  1. 深入了解惊群问题:Accept、Epoll及Nginx的优化策略

    2023-12-17 05:08:04       53 阅读
  2. 南京邮电大学数据库实验二

    2023-12-17 05:08:04       52 阅读
  3. Axure的交互以及情形的介绍

    2023-12-17 05:08:04       59 阅读
  4. QT作业3

    QT作业3

    2023-12-17 05:08:04      53 阅读
  5. rpc和http的区别,使⽤场景

    2023-12-17 05:08:04       56 阅读
  6. AR游戏开发

    2023-12-17 05:08:04       53 阅读
  7. 【Linux应用编程笔记】输入设备

    2023-12-17 05:08:04       53 阅读