Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
How can I get a list of locally installed Python modules?
Python is a flexible programming language that consists of thousands of libraries and libraries. As the Python environment grows with the installations, it is important to be able to check which packages are currently installed. Whether you are debugging or documenting the environment, listing locally installed python modules can be useful.
In this article, we will explore the different ways to get a list of locally installed python modules using the built-in tools and external commands.
Using pip list
The pip is the Python package installer and the list is tje subcommand that shows all the installed packages in the current Python environment. The '!' is used in the environments likes Jupyter Notebook or IPython to execute the shell commands.
Example
Let's look at the following example, where we are going to display a list of all the installed python packages along with their versions by using the below command.
!pip list
The output of the above program is as follows -
Package Version ------- ------- pip 24.3.1
Using help("modules")
The Python help() function is a built-in interactive help system. when the 'modules' are passed as a parameter, it scans the available modules and displays them. It may take a while to execute because it loads and checks all modules.
Example
In the following example, we are going to use the command that lists all the available modules, both built-in and installed, in the python environment.
C:\Users\Lenovo>python
>>> help("modules")
The following is the output of the above program -
Please wait a moment while I gather a list of all available modules... test_sqlite3: testing with SQLite version 3.45.3 __future__ _string faulthandler re __hello__ _strptime filecmp reprlib......
