Published on

How to check installed modules in Python

Authors
  • avatar
    Name
    hwahyeon
    Twitter

There are several ways to check the installed modules in Python. Below are some methods:

1. pip list

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.

2. pip freeze

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

3. pydoc modules

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

4. Python Built-in Help (help("modules"))

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")'