Pcornel
Automation · Python Automation

Virtual Environments

Cheat sheet · https://pcornel.dk/topic.php?topic=5256

Back to the Topic

Answer

Virtual environments (python -m venv .venv) isolate a project's Python packages from the system and other projects, so each automation has the exact dependencies it needs.

Remember

  • python -m venv .venv creates an isolated environment.
  • Activate before installing packages.
  • One venv per project.

First checks

  • python3 -m venv .venv — create
  • . .venv/bin/activate && which python — active env
  • pip freeze > requirements.txt — capture deps

Verify in this order

project → venv → isolated packages

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5256

Confirmation

Confirm action

Continue?