About this question
How can you get a list of all locally installed Python modules, and what commands or tools make it easy to view them? Learn different ways using pip, pip freeze, or Python’s built-in libraries to check installed packages.
How can you get a list of all locally installed Python modules, and what commands or tools make it easy to view them? Learn different ways using pip, pip freeze, or Python’s built-in libraries to check installed packages.
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Python Expert
Answered on Sep 4, 2025
Getting a list of locally installed Python modules is something every developer eventually needs, especially when setting up environments, troubleshooting dependencies, or sharing project requirements. Fortunately, Python offers several easy ways to do this, both from the command line and within a script.
The most common method is using pip, the default Python package manager. Simply run:
pip listThis will show you all installed packages along with their versions.
If you want the output in a format that can be shared or used to recreate the same environment, you can use:
pip freezeThis generates a list of packages in a requirements.txt-friendly format, which is perfect for deployment or collaboration.
You can also retrieve the list from within Python itself by using the pkg_resources or importlib.metadata libraries:
import pkg_resources
installed = [pkg.key for pkg in pkg_resources.working_set]
print(installed)Or, for Python 3.8 and above:
import importlib.metadata
print(importlib.metadata.distributions())Key Points:
In short, use pip list for a quick check, pip freeze for sharing, and Python’s libraries when you need the list inside a program.
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Most-read guides across JanBask
Common Python interview questions, answered
Guides, tips and career advice on Python from JanBask experts.
Python How to Become a Python Developer: A Step-by-Step Guide for Beginners
Discover how to become a Python Developer via a practical 7-step guide build projects, maintain clean code, practice daily, and…
Python PCEP Certification Guide: Entry-Level Python Programmer Certification
Explore this PCEP certification guide for insights on cost, exam format, passing score, application, training, and study tips.…
Python Top 50+ Python Projects ideas for Beginners to Advanced
Discover innovative Python project ideas, explore advanced Python projects, and find good Python projects for beginners and…
Python How To Comment Out Multiple Lines In Python Like A Pro
Commenting out code is a common practice among programmers. It allows you to temporarily disable parts of your code without…