gpt4 book ai didi

Linux Mint 上的 Python3 错误 "no module named bluetooth"

转载 作者:IT王子 更新时间:2023-10-29 00:09:36 24 4
gpt4 key购买 nike

我正在尝试通过蓝牙将我的联想 S10E 连接到任天堂 Wiimote。我正在使用一个简单的 Python 脚本,转载如下。我使用 python3 find_wii.py

从 Linux Mint(版本 16,“Petra”)命令行调用它

脚本:

import bluetooth

target_name = "Nintendo RVL-CNT-01"
target_address = "00:1C:BE:29:75:7F"

nearby_devices = bluetooth.discover_devices()

for bdaddr in nearby_devices:
if target_name == bluetooth.lookup_name( bdaddr ):
target_address = bdaddr
break

if target_address is not None:
print("found target bluetooth device with address "), target_address
else:
print("could not find target bluetooth device nearby")

我收到了错误

Traceback (most recent call last):
File "find_wii.py", line 1, in <module>
import bluetooth
ImportError: No module named 'bluetooth'

我已经为它安装了 bluez 和 python 包装(sudo aptitude install python-bluez)。我已经升级了我的系统(sudo apt-get updatesudo apt-get upgrade)。我确实咨询了谷歌,我能找到的唯一官方错误是 herehere ,这两个答案都不适合我。

如何让蓝牙模块工作?

最佳答案

sudo apt-get install bluetooth libbluetooth-dev
sudo python3 -m pip install pybluez

这对我在树莓派 3 上有效。

关于Linux Mint 上的 Python3 错误 "no module named bluetooth",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23985163/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com