- Published on
How to check installed modules in Python
- Authors
- Name
- hwahyeon
There are several ways to check the installed modules in Python. Below are some methods:
pip list
1. This command lists all installed packages along with their versions in a tabular format.
pip list
If the output is too long, you can use the --format=columns
option for better readability.
pip freeze
2. This command outputs the installed packages and their versions in a requirements.txt
format. It's useful for recording dependencies or replicating the environment in another system.
pip freeze
pydoc modules
3. This command lists all modules that Python recognizes, including built-in and installed third-party modules. The output can be very lengthy and may include duplicate module names.
pydoc modules
help("modules")
)
4. Python Built-in Help (This method uses Python's built-in help
function to display a list of all modules. The output can be very long, and loading all modules may take a significant amount of time depending on the system.
python -c 'help("modules")'