Virtual environments
venv creates an isolated Python environment with its own installed-package location and interpreter entry point. Activation adjusts the current shell’s PATH; using .venv/bin/python directly is also valid. A virtual environment is not a container or security sandbox. Recreate it from declared dependencies rather than committing its generated contents. python3 -m venv .venv followed by . .venv/bin/activate selects the project interpreter; python -c "import sys; print(sys.prefix)" should identify the .venv directory rather than the global installation. Per-project dependencies avoid incompatible package versions between exercises and make environment assumptions explicit, while direct interpreter invocation helps distinguish an activation problem from a genuinely missing package in the intended environment today. Installing with a different pip than the selected interpreter causes confusing imports; prefer python -m pip and verify sys.executable before changing dependencies, especially when multiple Python versions coexist on the machine used for practice.
python3 -m venv .venv followed by . .venv/bin/activate selects the project interpreter; python -c "import sys; print(sys.prefix)" should identify the .venv directory rather than the global installation.
Per-project dependencies avoid incompatible package versions between exercises and make environment assumptions explicit, while direct interpreter invocation helps distinguish an activation problem from a genuinely missing package in the intended environment today.
Installing with a different pip than the selected interpreter causes confusing imports; prefer python -m pip and verify sys.executable before changing dependencies, especially when multiple Python versions coexist on the machine used for practice.