How to create, activate, and deactivate a virtual environment (venv) using the CLI on an RPI.

Опубликовано: 06 Май 2026
на канале: Bros Who Know Stuff
611
16

#linuxcommandline #raspberrypi #raspberrypi5

A step-by-step tutorial showing how to create a virtual environment ( using the 'venv ' module ) on the (Linux) Raspberry Pi command line (CLI), how to activate, and then deactivate it.

Let's say you are building a project and it requires you to install (or clone) a few modules from Github or a repository. When you log into your Raspberry Pi shell your ultimately developing your project in a "global" environment as the pi-user. Now, let's pretend that a year later your working on another RPI project and it requires you to install a module with the "exact same name" as the one you installed in your previous project. Now, it's important to know that code sharing the same "name" modules can be rewritten in such a way that they will either not work or cause conflicts. This is why it's a good strategy in certain situations to use a virtual environment. It isolates those same-named modules in different working environments to eliminate conflicts in the projects.