Deep explanation of real virtual environment internals
This folder structure is created automatically when you use python -m venv venv and install packages using pip. It represents the internal working of Pythonβs package system.
venv/ ``` βββ Include/ βββ Lib/ β βββ site-packages/ β β βββ distutils_hack/ β β β βββ **pycache**/ β β β βββ **init**.py β β β βββ override.py β β βββ pip/ β β βββ pip-24.0.dist-info/ β β βββ pkg_resources/ β β βββ setuptools/ β β βββ setuptools-65.5.0.dist-info/ β β βββ distutils-precedence.pth β βββ Scripts/ β βββ pyvenv.cfg βββ data.txt
site-packages is the most important directory in any virtual environment. Every thirdβparty Python library installed using pip lives here.
This is an internal compatibility layer used by setuptools to override Pythonβs deprecated distutils module.
This folder contains the source code of pip itself. Pip is the package manager that downloads, installs, and manages Python libraries.
Folders like pip-24.0.dist-info and setuptools-65.5.0.dist-info store package metadata.
Used internally by setuptools to discover and load packages dynamically. Many frameworks rely on this during runtime.
A .pth file tells Python which libraries should take priority while importing modules. It ensures setuptools is preferred over legacy distutils.
Contains executables for this virtual environment.
Stores configuration such as:
Never manually edit files inside site-packages. If something breaks, delete the venv and recreate it.