python使用蓝牙库选择

蓝牙库选择

pybluez

项目地址:https://github.com/pybluez/pybluez
文档地址:https://pybluez.readthedocs.io/en/latest/index.html
蓝牙支持:经典蓝牙 / BLE蓝牙【仅Linux】
平台支持:

LinuxRaspberry PimacOSWindows
✔️✔️✔️✔️

bluepy

项目地址:https://github.com/IanHarvey/bluepy
蓝牙支持:BLE蓝牙【仅Linux】
平台支持:Linux

gatt-python

项目地址:https://github.com/getsenic/gatt-python
蓝牙支持:BLE蓝牙【仅Linux】
平台支持:Linux

PySide6.QtBluetooth

Qt for Python的蓝牙,文档 https://doc.qt.io/qtforpython-6/PySide6/QtBluetooth/index.html
蓝牙支持 / 平台支持:
在这里插入图片描述

bleak

项目地址:https://github.com/hbldh/bleak
文档地址:https://bleak.readthedocs.io/en/latest/
蓝牙支持:BLE蓝牙【windows 10/Linux】
平台支持:

  • Supports Windows 10, version 16299 (Fall Creators Update) or greater
  • Supports Linux distributions with BlueZ >= 5.43 (See Linux backend for more details)
  • OS X/macOS support via Core Bluetooth API, from at least OS X version 10.11

pybluez安装

pip安装

pip install pybluez

具体安装细节详见 https://github.com/pybluez/pybluez/blob/master/docs/install.rst

常见错误

错误一:使用废弃的 use_2to3 报错

安装错误

$ pip install --upgrade pybluez
Collecting pybluezUsing cached PyBluez-0.23.tar.gz (97 kB)Installing build dependencies ... doneGetting requirements to build wheel ... errorerror: subprocess-exited-with-error× Getting requirements to build wheel did not run successfully.│ exit code: 1╰─> [1 lines of output]error in PyBluez setup command: use_2to3 is invalid.[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.note: This error originates from a subprocess, and is likely not a problem with pip.

错误原因详见:PyBluez Issues#431
解决方案:使用如下命令从源代码安装

pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez

错误二:源码安装没有对应的Microsoft Visual C++ 14.0库

$ pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez
Collecting pybluezCloning https://github.com/pybluez/pybluez.git to c:\users\acer\appdata\local\temp\pip-install-mki8zoy9\pybluez_5660e54d6b4643c2a85546348792a2eeRunning command git clone --filter=blob:none --quiet https://github.com/pybluez/pybluez.git 'C:\Users\acer\AppData\Local\Temp\pip-install-mki8zoy9\pybluez_5660e54d6b4643c2a85546348792a2ee'Resolved https://github.com/pybluez/pybluez.git to commit 4d46ce14d9e888e3b0c65d5d3ba2a703f8e5e861Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pybluezBuilding wheel for pybluez (pyproject.toml) ... errorerror: subprocess-exited-with-error× Building wheel for pybluez (pyproject.toml) did not run successfully.│ exit code: 1╰─> [15 lines of output]running bdist_wheelrunning buildrunning build_pycreating buildcreating build\lib.win-amd64-cpython-311creating build\lib.win-amd64-cpython-311\bluetoothcopying bluetooth\ble.py -> build\lib.win-amd64-cpython-311\bluetoothcopying bluetooth\bluez.py -> build\lib.win-amd64-cpython-311\bluetoothcopying bluetooth\btcommon.py -> build\lib.win-amd64-cpython-311\bluetoothcopying bluetooth\macos.py -> build\lib.win-amd64-cpython-311\bluetoothcopying bluetooth\msbt.py -> build\lib.win-amd64-cpython-311\bluetoothcopying bluetooth\__init__.py -> build\lib.win-amd64-cpython-311\bluetoothrunning build_extbuilding 'bluetooth._msbt' extensionerror: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.ERROR: Failed building wheel for pybluez
Failed to build pybluez
ERROR: Could not build wheels for pybluez, which is required to install pyproject.toml-based projects

解决方式:从https://visualstudio.microsoft.com/visual-cpp-build-tools/下载Microsoft C++ 生成工具安装后重新执行指令。

在这里插入图片描述

$ pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez
Collecting pybluezCloning https://github.com/pybluez/pybluez.git to c:\users\acer\appdata\local\temp\pip-install-n2w1b_hj\pybluez_e8804231d731412e974e0d8e7a4a56f4Running command git clone --filter=blob:none --quiet https://github.com/pybluez/pybluez.git 'C:\Users\acer\AppData\Local\Temp\pip-install-n2w1b_hj\pybluez_e8804231d731412e974e0d8e7a4a56f4'Resolved https://github.com/pybluez/pybluez.git to commit 4d46ce14d9e888e3b0c65d5d3ba2a703f8e5e861Installing build dependencies ... doneGetting requirements to build wheel ... donePreparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pybluezBuilding wheel for pybluez (pyproject.toml) ... doneCreated wheel for pybluez: filename=PyBluez-0.30-cp311-cp311-win_amd64.whl size=38986 sha256=a37ebad09bb1196f44d7a90900694c0ac1802c83efef5d3766a908dc6b23fd84Stored in directory: C:\Users\acer\AppData\Local\Temp\pip-ephem-wheel-cache-dtnnjqfc\wheels\99\fe\57\0c682c42e37c808dc69125bf83b302f94976743c8cb038a845      
Successfully built pybluez
Installing collected packages: pybluez
Successfully installed pybluez-0.30

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/87795.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

分享40个Python源代码总有一个是你想要的

分享40个Python源代码总有一个是你想要的 源码下载链接:https://pan.baidu.com/s/1PNR3_RqVWLPzSBUVAo2rnA?pwd8888 提取码:8888 下面是文件的名字。 dailyfresh-天天生鲜 Django-Quick-Start freenom-自动续期域名的脚本 Full Stack Python简体中…

ADC数模转化器

简介 • ADC ( Analog-Digital Converter )模拟 - 数字转换器 • ADC 可以将引脚上连续变化的模拟电压转换为内存中存储的数字变量,建立模拟电路到数字电路的桥梁 • 12 位逐次逼近型 ADC , 1us 转换时间 (12位:分辨率…

02 MIT线性代数-矩阵消元 Elimination with matrices

一, 消元法 Method of Elimination 消元法是计算机软件求解线形方程组所用的最常见的方法。任何情况下,只要是矩阵A可逆,均可以通过消元法求得Axb的解 eg: 我们将矩阵左上角的1称之为“主元一”(the first pivot),第…

MySQL库表操作

开始之前分享一个数据库远程连接工具: Navicat Premium 15 可以远程连接数据库,并且查看表的结构等,非常好用。 SQL语句基础 SQL:结构化查询语言(Structured Query Language),在关系型数据库上执行数据操作、数据检索…

景联文数据标注:AI大模型产生幻觉该如何应对?

大语言模型在诸多下游任务中展现出令人瞩目的能力,然而在运用过程中仍然存在一些问题。幻觉现象是目前阻碍大模型成功应用的关键问题之一。 什么是大模型幻觉问题? 大模型幻觉问题是指一些人工智能模型在面对某些输入时,会生成不准确、不完整…

算法 寻找第k大数-(快速排序+双指针)

牛客网: BM47 题目: 数组第K大的数 思路: 见最小的k个数,将num[right] > pivot的元素左调,最终返回num[k-1] 代码: // gopackage main // import "fmt"/*** 代码中的类名、方法名、参数名已经指定,请勿修改,直接…

Visual Studio Cpp CLR C# 替换

1、首先将文件中所有都替换 你需要的名字 替换为整个解决方案 2、新建工程取名 Laserbeam_upper 3、把原工程下的cpp放进来,并改名Laserbeam_upper 4、在这里逐步添加 属性表配置opencv 5、cpp需要修改的两个地方 6、CLR新建和添加 选类库新建、然后直接粘贴进来…

leetcodetop100(28) 两两交换链表中的节点

两两交换链表中的节点 给你一个链表,两两交换其中相邻的节点,并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题(即,只能进行节点交换) package TOP21_30;import Util.ListNode;//两两交换链表…

阿里云七代云服务器实例、倚天云服务器及通用算力型和经济型实例规格介绍

在目前阿里云的云服务器产品中,既有五代六代实例规格,也有七代和八代倚天云服务器,同时还有通用算力型及经济型这些刚推出不久的新品云服务器实例,其中第五代实例规格目前不在是主推的实例规格了,现在主售的实例规格是…

php实现分页功能跳转和ajax方式实现

实现效果 准备工作 创建数据表和导入测试数据 CREATE TABLE users ( id int(10) unsigned NOT NULL AUTO_INCREMENT, username varchar(30) DEFAULT NULL COMMENT 账号, email varchar(30) DEFAULT NULL COMMENT 密码, PRIMARY KEY (id) ) ENGINEMyISAM AUTO_INCREM…

小程序 解决自定义弹窗滚动穿透问题,解决弹窗背景内容滚动问题

方法一、catchtouchmove"true"&#xff0c; 可以实现弹框背景不滚动&#xff0c;但是也会导致弹框自身无法滚动&#xff0c;如果你的弹窗本身是不需要滚动的&#xff0c;用这个方法是极佳的。 <view class"pop" catchtouchmove"true"> …

安卓Compose(二)

在上一篇博客中&#xff0c;我们已经了解了安卓Compose的一些基本概念以及使用方法&#xff0c;接下来我们将继续深入学习。 一、Compose的基础组件 文本组件(Text) 文本组件是Compose中最基本的组件之一&#xff0c;用于在界面上显示文本。使用方式如下&#xff1a; // 定…

【OpenSSL】OpenSSL实现Base64

Base 64概述和应用场景 概述 Base64就是将二进制数据转换为字符串的一种算法。 应用场景 邮件编码xml或则json存储二进制内容网页传递数据URL数据库中以文本形式存放二进制数据可打印的比特币钱包地址base58Check(hash校验)网页上可以将图片直接使用Base64表达公私密钥的文…

计算机竞赛 深度学习交通车辆流量分析 - 目标检测与跟踪 - python opencv

文章目录 0 前言1 课题背景2 实现效果3 DeepSORT车辆跟踪3.1 Deep SORT多目标跟踪算法3.2 算法流程 4 YOLOV5算法4.1 网络架构图4.2 输入端4.3 基准网络4.4 Neck网络4.5 Head输出层 5 最后 0 前言 &#x1f525; 优质竞赛项目系列&#xff0c;今天要分享的是 &#x1f6a9; *…

【数据结构】顺序串

顺序串 字符串简称串&#xff0c;计算机上非数值处理的对象基本都是字符串数据。我们常见的信息检索系统(如搜索引擎)、文本编辑程序(如Word)、问答系统、自然语言翻译系统等&#xff0c;都是以字符串数据作为处理对象的。本章详细介绍字符串的存储结构及相应的操作。 实现功…

【Vue.js】使用Element搭建首页导航左侧菜单

一&#xff0c;Mock.js 1.1 认识Mock.js Mock.js是一个用于前端开发中生成随机数据、模拟接口响应的 JavaScript 库。模拟数据的生成器&#xff0c;用来帮助前端调试开发、进行前后端的原型分离以及用来提高自动化测试效率 总结来说&#xff0c;Element中的Mock.js是一个用于…

怎样快速打开github.com

1访问这个网站很慢是因为有DNS污染&#xff0c;被一些别有用心的人搞了鬼了&#xff0c; 2还有一个重要原因是不同的DNS服务器解析的速度不一样。 1 建议设置dns地址为114.114.114.114.我觉得假设一个县城如果有一个DNS服务器的话&#xff0c;这个服务器很可能不会存储…

[论文笔记]P-tuning v2

引言 今天带来第五篇大模型微调论文笔记P-tuning v2: Prompt Tuning Can Be Comparable to Fine-tuning Across Scales and Tasks。 作者首先指出了prompt tuning的一些不足,比如在中等规模的模型上NLU任务表现不好,还不能处理困难的序列标记任务,缺乏统一应用的能力。 然…

【Spring Boot】实战:实现Session共享

🌿欢迎来到@衍生星球的CSDN博文🌿 🍁本文主要学习实现Session共享 🍁 🌱我是衍生星球,一个从事集成开发的打工人🌱 ⭐️喜欢的朋友可以关注一下🫰🫰🫰,下次更新不迷路⭐️💠作为一名热衷于分享知识的程序员,我乐于在CSDN上与广大开发者交流学习。 💠我…

【Clickhouse2022.02 查询优化】

一、现场场景概述 现场每天每张表入库数据量大约2-4亿条,页面涉及到自定义时间段查询(白天08:00-15:00,夜晚23:00-06:00)与不同时间段(最近一天、一周、一个月和全部)的统计指标查询。 二、主要问题 时间跨度大无查询或查询条件命中数据过多的分页查询场景速度慢 (主要是数据…