8

I have successfully connected my cell phone to the Raspberry Pi's onboard bluetooth. I know the Bluetooth works, but I cannot get import bluetooth to work properly.

I get this error when I run the script:

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

How do I fix this, or what do I need to do to make this work?

2
  • Did you install PyBlueZ?
    – Bex
    Apr 5, 2016 at 10:26
  • Says unable to locate package PyBlueZ Apr 7, 2016 at 21:59

1 Answer 1

9

You need to install bluetooth library

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

and try again your code.

Regards

Edit: Answer's source was broken, so deleted

8
  • 1
    Those packages are already installed, each says: package is already the newest version.... The following package was automatically installed and is no longer required: py py-upstream-doc Apr 7, 2016 at 22:04
  • did you run pip install bluez ?
    – ahmetertem
    Apr 7, 2016 at 22:06
  • "Could not find any downloads that satisfy the requirement bluez" ... Cleaning up... "No distributions at all found for bluez", "Storing debug log for failure in /home/pi/.pip/pip.log Apr 7, 2016 at 23:12
  • Is your python version over 3.5 ?
    – ahmetertem
    Apr 7, 2016 at 23:14
  • maybe thats the problem... python -V returned Python 2.7.9. how do I use or get 3.5? Apr 7, 2016 at 23:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.