Python3 "no module called bluetooth" bug on Linux Mint

I am trying to connect my Lenovo S10E to a Nintendo Wiimote via bluetooth. I am using a simple Python script reproduced below. I call it from the Linux Mint command line (version 16, "Peter") usingpython3 find_wii.py

Script:

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")

I get an error

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

I installed bluez and python ( sudo aptitude install python-bluez) shells for it . I updated my system ( sudo apt-get update, sudo apt-get upgrade). I consulted with Google, and the only official errors I could find were here and here , and none of the answers worked for me.

How can I make the bluetooth module work?

+4
3

Python 2. script python2, Python 3. , pip:

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

pi 3.

+3

with Ubuntu 16.04, I had the same problem. I installed pybluez and fixed the import problem. I installed it using:

sudo pip3 install pybluez
0
source

Source: https://habr.com/ru/post/1542855/


All Articles