This step is optional, you may skip to the Installing MQTT Client section.
Download and extract the latest version of Python 3:
cd /optsudo wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgzsudo tar xzf Python-3.8.0.tgz
Install the dependencies:
sudo apt-get install build-essential checkinstallsudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Run configure with optimizations and make install from the source:
This step may take up to 15min. depending on the model of the device.
cd Python-3.8.0sudo ./configure --enable-optimizationsmake altinstall
Update the link to the newly installed version of Python 3:
ln -s /usr/local/bin/python3.8 /usr/local/bin/python3
Restart your device in order to make sure Python 3 version is updated
Test your installation:
python3 --versionPython 3.8.0
This documentation uses Paho MQTT as a client library.
Make sure pip3 is installed before installing the library:
sudo apt-get -y install python3-pipsudo apt-get update
Install the library by running the following command:
pip3 install paho-mqtt
Start connecting devices by following the guide :