pip and venv
corebeginnerpip installs, upgrades, and removes Python packages. venv creates an isolated environment with its own pip and package directory, so installing something for one project never affects another.
Think of it as
Without venv, every project shares ONE global set of installed packages — two projects needing different versions of the same library collide. venv gives each project its own private copy, like a separate toolbox per job instead of one shared one.
What we're doing: Create a real venv and inspect its structure, confirming it has its own isolated python and pip.
- 1
- This creates the entire isolated environment — its own Python, its own pip, its own site-packages directory.
- 4
- The directory name (Scripts on Windows, bin elsewhere) is the one real cross-platform difference in an otherwise identical structure.
Include
Lib
Scripts
pyvenv.cfgWhy this works: A venv is a real, self-contained directory tree — Scripts/python.exe (or bin/python) is a separate interpreter installation pointing back at the system Python's standard library, with its OWN site-packages for installed packages, isolated from every other environment.
Installing packages globally instead of into a venv
Wrong
Better
What you see: Two projects on the same machine cannot use different versions of the same package — installing one breaks the other.
Why: Without an active venv, pip install targets the single global Python installation, shared by every project on the machine. A venv gives each project its own isolated package set, so version requirements never collide across projects.
- No venv active
- pip install targets the ONE global Python
- Every project on the machine shares it
- Two projects needing different versions collide
- .venv activated
- Its own python and pip, first on PATH
- Its own isolated site-packages directory
- Disposable — delete and recreate, affects nothing else
pip — the commands worth knowing
Together
Remember: venv gives each project its own isolated Python and package set; pip installs into whichever environment is currently active.
See also: dependencies pinning and ranges · virtual environments and python version management · pip and uv

