tonytran
Aug 18, 2025
Python Virtual Environments
When working on Python projects, one of the most important best practices is using a virtual environment. A virtual environment (venv) is an isolated space on your machine where you can install project-specific dependencies without affecting your global Python setup.
Why Use a Virtual Environment?
Isolation
Reproducibility
Flexibility
How to Create and Use a Virtual Environment?
cd <projdct>python3 -m venv venvsource venv/bin/activatedeactivatecd ..How to Install Packages?
pip3 freeze > requirements.txtpip3 install -r requirements.txt2