6

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?

  • Did you install PyBlueZ? – Bex Apr 5 '16 at 10:26
  • Says unable to locate package PyBlueZ – Kyle Bradley Apr 7 '16 at 21:59
5

You need to install bluetooth library

sudo apt-get update
sudo apt-get install bluetooth
sudo apt-get install bluez
sudo apt-get install python-bluez

and try again your code.

Regards

  • 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 – Kyle Bradley Apr 7 '16 at 22:04
  • did you run pip install bluez ? – ahmetertem Apr 7 '16 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 – Kyle Bradley Apr 7 '16 at 23:12
  • Is your python version over 3.5 ? – ahmetertem Apr 7 '16 at 23:14
  • maybe thats the problem... python -V returned Python 2.7.9. how do I use or get 3.5? – Kyle Bradley Apr 7 '16 at 23:21

protected by Ghanima May 17 '16 at 15:05

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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