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?

  • 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
6

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

Answer found in https://www.javaear.com/question/23985163.html

| improve this answer | |
  • 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

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