- 1. 前言
- 2. 安装方法
- 2.1 基于源码安装
- 2.2 通过pip安装
- 3. 写在最后
Bleak 是一款 BLE GATT 客户端软件,能够连接到充当 GATT 服务器的 BLE 设备。它旨在提供一个异步的、跨平台的 Python API 来连接和通信。源码下载地址。
2. 安装方法这里我们介绍两种安装方法,一个是通过源码安装,一个是通过pip安装。
2.1 基于源码安装源码下载下来后,解压出来是这样的:
可以看到里面有setup.py文件,这个是安装文件,通过 --help 可以查看支持的命令:
$ python setup.py --help Common commands: (see '--help-commands' for more) setup.py build will build the package underneath 'build/' setup.py install will install the package Global options: --verbose (-v) run verbosely (default) --quiet (-q) run quietly (turns verbosity off) --dry-run (-n) don't actually do anything --help (-h) show detailed help message --no-user-cfg ignore pydistutils.cfg in your home directory --command-packages list of packages that provide distutils commands Information display options (just display information, ignore any commands) --help-commands list all available commands --name print package name --version (-V) print package version --fullname print- --author print the author's name --author-email print the author's email address --maintainer print the maintainer's name --maintainer-email print the maintainer's email address --contact print the maintainer's name if known, else the author's --contact-email print the maintainer's email address if known, else the author's --url print the URL for this package --license print the license of the package --licence alias for --license --description print the package description --long-description print the long package description --platforms print the list of platforms --classifiers print the list of classifiers --keywords print the list of keywords --provides print the list of packages/modules provided --requires print the list of packages/modules required --obsoletes print the list of packages/modules made obsolete usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help
可以得知可以通过 setup.py install 安装:
python setup.py install2.2 通过pip安装
一条命令解决:
pip install bleak3. 写在最后
本文主要介绍了Bleak的环境安装,是Bleak专栏的第一步,后续我们会慢慢地对Bleak支持的功能进行挖掘。
通过Bleak,可以很方便地在Windows上开发BLE应用或测试工具。



