Python Profiling and Troubleshooting Cheat Sheet/Print site-package configuration

Inspect interpreter paths and site initialization.

Section: Startup and Import Troubleshooting

Print site-package configuration

bash
bash
python -m site

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Startup and Import Troubleshooting
Show import statements as they happen
Print detailed import resolution activity.
OpenIn sheetbashsame section
Save cProfile output to a file
Store profile stats for later analysis.
Show garbage collector stats
Inspect GC activity when memory grows unexpectedly.
Inspect saved profile stats
Read and sort a saved profile run.
Force a garbage collection cycle
Useful for experiments while diagnosing leaks.