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.
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.
Page last edited March 08, 2024
Text editor powered by tinymce.