Stage 6 · Lesson 2 of 8
Virtual environments and pip
A is a private folder of packages for one project. It stops projects fighting over versions, and nothing gets installed for the whole system. Create one with python -m venv .venv and then activate it: source .venv/bin/activate on macOS and Linux, or .venv\Scripts\activate on Windows.
Then install what you need with pip, such as pip install requests. Record the list with pip freeze > requirements.txt. A stranger then recreates it with pip install -r requirements.txt.
Add .venv to .gitignore. Newer tools such as uv and wrap the same ideas around a pyproject.toml and a . Either is fine, but learn the plain venv and pip flow first, so you know what they automate.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- GitHub repoFreeProject Based Learning
Community maintained · Beginner
Follow one guided build in your language, then build your own without a guide
- BookFreeAutomate the Boring Stuff with Python
Al Sweigart · Beginner
Free book of practical scripts: files, spreadsheets, web scraping and email
Keep handy
Also worth your time
How to present each project: the problem, stack, challenges and results
- Build Your Own XGo deeper
When you want a harder build: a shell, a key-value store or a tiny Git, from scratch