Without virtual environments, every project shares the same packages, and that gets messy fast.
Direct answer
A virtual environment is an isolated copy of Python tools and packages for one project. Create one with python -m venv .venv, activate it, then install packages with pip. Each project then has its own set of versions.
Create and activate
python -m venv .venv
Activate it:
# macOS and Linux
source .venv/bin/activate
# Windows (PowerShell)
.venv\Scripts\Activate.ps1
When active, your prompt usually shows (.venv).
Install packages
pip install requests
pip freeze > requirements.txt
Leave and delete
deactivate
To delete it, remove the .venv folder. Your code is not affected.
Why bother
- Avoids conflicts between projects needing different versions.
- Makes sharing easy with a
requirements.txt. - Keeps your system Python clean.
Where Teyro fits
Teyro's Python for Beginners course turns this into short lessons you can play in a few minutes a day. It has 120 lessons, and you can start free.
The bottom line
One project, one environment. It saves hours of debugging later.


