我正在尝试安装 pybluez 软件包,但是我遇到了与尝试安装 btzen 时遇到的相同错误,然后我就跳过了。这是我的终端到目前为止的样子;
$ pip install pybluez --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Collecting pybluez
Using cached PyBluez-0.23.tar.gz (97 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pybluez
Building wheel for pybluez (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
/home/kaustubhpawar/.local/lib/python3.11/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'use_2to3'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.11
creating build/lib.linux-x86_64-3.11/bluetooth
copying bluetooth/msbt.py -> build/lib.linux-x86_64-3.11/bluetooth
copying bluetooth/bluez.py -> build/lib.linux-x86_64-3.11/bluetooth
copying bluetooth/btcommon.py -> build/lib.linux-x86_64-3.11/bluetooth
copying bluetooth/macos.py -> build/lib.linux-x86_64-3.11/bluetooth
copying bluetooth/__init__.py -> build/lib.linux-x86_64-3.11/bluetooth
copying bluetooth/widcomm.py -> build/lib.linux-x86_64-3.11/bluetooth
copying bluetooth/ble.py -> build/lib.linux-x86_64-3.11/bluetooth
running build_ext
creating build/temp.linux-x86_64-3.11
creating build/temp.linux-x86_64-3.11/bluez
x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -g -fwrapv -O2 -fPIC -I./port3 -I/usr/include/python3.11 -c bluez/btmodule.c -o build/temp.linux-x86_64-3.11/bluez/btmodule.o
In file included from bluez/btmodule.c:20:
bluez/btmodule.h:5:10: fatal error: bluetooth/bluetooth.h: No such file or directory
5 | #include <bluetooth/bluetooth.h>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pybluez
Running setup.py clean for pybluez
Failed to build pybluez
ERROR: Could not build wheels for pybluez, which is required to install pyproject.toml-based projects
我也使用 pip3 来实现此目的。
我已经尝试获取车轮的 pip 包,但根本不起作用。所以我现在遇到了障碍。
您需要安装一些开发库来构建 python 包。如果您使用的是
Debian
或 Ubuntu
,则必须安装 libbluetooth-dev
:
[...]$ sudo apt install libbluetooth-dev
然后再次尝试安装
pybluez
。