Virtual Environments & PackagingIntermediate
1Question 1 of 1
bashHow do Python Virtual Environments (venv) and modern packaging tools (Poetry, UV) manage dependencies?
Explanation & Concept
Python packages installed via `pip` globally can cause version conflicts across projects. Virtual environments isolate site-packages and Python binaries per project.
Modern tools like **uv** and **Poetry** resolve dependencies deterministically using lockfiles (`poetry.lock`), providing reproducible environments across machines.
Code Example
bash
# Create virtual environment using standard venv
python -m venv .venv
# Activate on Linux/macOS
source .venv/bin/activate
# Activate on Windows PowerShell
# .venv\Scripts\Activate.ps1
# Install requirements
pip install -r requirements.txtHow It Works & Key Takeaways
Activating `.venv` redirects the shell's `python` and `pip` paths to the project folder, preventing system-level package corruption.
Mock Test · 1 Questions · Optional
Ready for Lambda & Functional Tools?
Take a quick test to evaluate yourself, or move straight to the next module.
Advanced1 questions