Learn how to create and manage Python virtual environments using uv, the modern Python package manager!
This beginner-friendly tutorial shows you step-by-step how to:
Initialize a Python project with uv init
Create a virtual environment with uv venv (Mac & Windows)
Activate and deactivate your environment
Install packages safely inside your project
Lock dependencies with uv lock
Recreate environments with uv sync
Whether you’re a QA engineer, developer, or Python beginner, this video will help you avoid package conflicts and set up isolated, reproducible environments for every project.
Topics Covered:
What is a Python virtual environment?
How to create and activate Python virtual environments (Mac & Windows)
Introduction to uv package manager
Locking and syncing dependencies
Best practices for managing Python projects
🔹 Commands Used in This Video (uv Virtual Environments)
Install uv
Mac & Linux
curl -Ls https://astral.sh/uv/install.sh | sh
Windows (PowerShell)
irm https://astral.sh/uv/install.ps1 | iex
Verify uv Installation
uv --version
Create a Project Folder
mkdir my_python_project
cd my_python_project
Initialize a Python Project (creates pyproject.toml)
uv init
Create a Virtual Environment
uv venv
Activate the Virtual Environment
Mac / Linux
source .venv/bin/activate
Windows
.venv\Scripts\activate
Install Packages Inside the Environment
uv add requests
Lock Dependencies
uv lock
Recreate Environment from Lock File
uv sync
Deactivate the Virtual Environment
deactivate
Remove Environment and Start Fresh (Optional)
rm -rf .venv
✅ Next Video (Updated Section)
Up next:
🎯 Python VS Code Setup Tutorial | Best Editor Setup for Python (Mac & Windows)
Now that you understand what a Python virtual environment is and how to create one using uv, the next step is setting up your code editor properly.
In the next video, you’ll learn how to configure VS Code to work seamlessly with Python and your virtual environments. We’ll install the right extensions, select the correct Python interpreter, and run your first Python script inside VS Code.
This setup will be used throughout the rest of the playlist, so make sure you don’t skip it.
👉 Continue with the playlist to keep building your Python foundation step by step.
#Python #PythonVirtualEnvironment #PythonUV #PythonTutorial #PythonForBeginners #QAandDevTips #PythonDev #VirtualEnvironment #PythonAutomation #PythonUV
In questa pagina del sito puoi guardare il video online Virtual Environments with uv in Python | Create, Activate & Lock Dependencies (Mac & Windows) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato QA and Dev Tips 04 gennaio 2026, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 276 volte e gli è piaciuto 8 spettatori. Buona visione!