This library is deprecated in favor of the Adafruit_Blinka_bleio library. See this guide for more information: https://learn.adafruit.com/circuitpython-ble-libraries-on-any-computer

Follow the appropriate steps below depending on your platform to install the Bluefruit LE Python library.

Mac OSX

On Mac OSX nothing extra needs to be installed to use the library.  The library makes use of the PyObjC library that Apple includes with the version of Python installed in OSX.

Note that if you're using a non-Apple version of Python, like one installed with Homebrew, you might need to manually install PyObjC!

Skip down to the Library Installation section at the bottom to continue.

Linux & Raspberry Pi

The Raspberry Pi 3, 4, and Pi Zero W include Bluetooth capability. Recent versions of Raspbian include the bluez package. If it is not already installed, you can install it by doing:

apt list bluez  # See whether bluez is already installed.
# If not, do this:
sudo apt update
sudo apt install bluez

After you have installed bluez, you need to add yourself to the bluetooth user group:

sudo useradd -G bluetooth $USER

Then reboot.

Note the Python Bluetooth LE library below only supports Python 2.7 right now and not yet Python 3.x.

 Library Installation

To install the library globally, use pip:

pip install --user Adafruit-BluefruitLE

Alternatively, you can clone it from its home on GitHub and then run its setup.py as below.  Assuming you have git installed you can run the following in a terminal to clone the library and install it:

git clone https://github.com/adafruit/Adafruit_Python_BluefruitLE.git
cd Adafruit_Python_BluefruitLE
sudo python setup.py install

That's it, the library should be installed globally and ready to use with any Python script on your system.  

Alternatively you can install with `sudo python setup.py develop' to put the library into develop mode where changes to the code are immediately reflected without the need to reinstall.  This is handy if you're modifying the code or updating it frequently from GitHub.

Continue on to learn about the examples included with the library and how to use it in your own code.

This guide was first published on Aug 18, 2015. It was last updated on Aug 18, 2015.

This page (Installation) was last updated on May 10, 2021.

Text editor powered by tinymce.