Skip to lesson content

Programming Basics · Lesson 8 of 17

Setup of Virtual Environment

Keep your project's Python packages separate from the rest of your system.

The setup script also enables GPIO and SPI on your Raspberry Pi.

Create the setup file

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

Add the setup script

Paste the script below:

Save and run the script

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