To run CircuitPython BLE libraries on a host computer, you'll need at least Python 3.7, and you'll need the
pip3 program to install the libraries. You may have
pip already, but often the
pip (not pip3) command installs software for Python 2, so make sure you are using
As of this writing (October 2020), the latest Python available on Windows is Python 3.9. But the third-party libraries we are using for BLE on Windows are not yet compatible with Python 3.9. So choose Python 3.8, not 3.9, to install.
If you don't use the Windows Store version, make sure you check the box to add Python to your PATH when you run the installer. See the screenshot below.
Depending on how you install Python 3, the command to start it in a command shell in Windows can be different.
- Installed from the https://python.org download:
py.exe, the Python launcher).
Does not work:
python3.exe). You'll get directed to the Windows Store to install Python 3 yet again.
- Installed from the Windows Store:
Does not work:
py(the Python launcher is not installed).
These differences can be confusing; see this page for detailed documentation.
Modern MacOS comes with Python 3, but it may be an older version. Instead of using the system-supplied version, we recommend that you use the Homebrew system to install a more recent version of Python 3 and keep it up to date. The Homebrew installation will not interfere with the system-installed Python, and does not replace it.
This article describes in detail various ways of managing Python on MacOS. It's worth reading to understand the issues, and to see various ways of managing multiple versions of Python.
A user has reported that, at least as of MacOS Big Sur, you must add your terminal application to the Bluetooth Privacy Settings in System Preferences > Security & Privacy > Privacy > Bluetooth.
Modern versions of Linux always come with Python. They may include both Python 2 and Python 3. See if the version supplied with your Linux distribution is at least 3.7, and preferably 3.8. If not, your distribution may allow you to install additional versions that do not interfere with the original system-supplied version. If you can upgrade your distribution, considering doing so. For instance, Ubuntu 20.04 comes with Python 3.8.
Make sure you have
pip3 installed as well, by trying to run it. If it's not installed, install it in the appropriate way for your Linux distribution. For instance, for Ubuntu and Debian, do:
Raspberry Pi OS (the new name for Raspian), which is based on Debian Linux, also comes with Python. The latest version as of this writing, buster, comes with Python 3.7, invoked with the
python3 command. It also comes with Python 2.7, invoked as
python. Do not use Python 2 for this guide.
If you are using Raspberry Pi OS Lite, it may not come with
pip3. You'll need to install it by doing:
sudo When Running
You may see Internet advice to install libraries using
sudo pip3 on Linux or MacOS. This is in general a bad idea, because you can damage the libraries that the underlying system depends on, and in general end up trashing your system in mysterious ways. Always install using
sudo. If your
pip3 is old, you may need to specify
pip3 --user, but these days
--user is often the default.
Here's a detailed discussion of why
sudo pip3 is a bad idea.