Setup of Virtual Environment

In this tutorial, we will cover the setup of virtual environments in Python.

Virtual environments are isolated instances of Python to have separation between projects and the main Python environment.

To easily set up the virtual environment and enable GPIO and SPI on the Raspberry Pi follow the steps below.

To create a new bash file, you can do so by typing touch setup_virtual_env.sh

Open the bash file via nano setup_virtual_env.sh

In the Nano editor, you can directly start typing your code

Paste the script below:

To save the changes, press Ctrl + O, then press Enter. To exit, press Ctrl + X

Ctrl + O saves your changes, and Ctrl + X exits the editor

Then you can run the bash file via bash setup_virtual_env.sh

Co funded by the EU

Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Education and Culture Executive Agency (EACEA). Neither the European Union nor EACEA can be held responsible for them.

Project Number: 2023-3-CY02-KA210-YOU-000173087