Python virtual environments

Python virtual environments

When working on multiple python projects, dependencies might conflict. For example, a project might use version 1.5 of Tensorflow while another uses version 2.1.

To solve this problem, virtual environments can be used. A virtual environment can be created for each of those projects and specific modules can be installed within those so as not to have conflict between project.

Creating a virtual environment can be done as follows:

python -m venv path_of_my_venv

The environment can then be activated (entered) using:

source path_to_venv/bin/activate

When an environment is activated, it can be deactivated simply using:

deactivate