Creating a Virtual Environment (Optional)
It is recommended to create a virtual environment to install the libraries locally rather than globally, although, it's optional to do so.
python3 -m venv venv
A new directory called venv will be created. To activate the virtual environment, run the following command from your directory:
source ./venv/bin/activate
(venv) should be seen in front of your username.
To check that you've seperated your libraries from the computer's libraries, run:
pip list
Your library list should have barely any libraries.
Installation Of The Library
RaspbotV2 comes with its own built in library called Raspbot_Lib which can be found on their official website.
The zip file can be found here.
Unzip the file.
unzip py_install.zip
Install the library.
pip install ./py_install/dist/Raspbot_Lib-0.0.2-py3-none-any.whl
Check for installed library
pip list
Output:
Package Version
----------- -------
pip 22.0.2
Raspbot-Lib 0.0.2
setuptools 59.6.0
To import the library in python:
import Raspbot_Lib
A common error to run into is:
ModuleNotFoundError: No module named 'smbus'
The "smbus" library is needed to use i2c communication with the Raspberry PI. To fix it, simply install the "smbus" library using pip.
pip install smbus