How can I get a list of locally installed Python modules?

PythonServer Side ProgrammingProgramming

There are multiple ways to get a list of locally installed Python modules. Easiest way is using the Python shell, for example,

>>> help('modules')
Please wait a moment while I gather a list of all available modules...
BaseHTTPServer      brain_nose          markupbase          stat
Bastion             brain_numpy         marshal             statvfs
CGIHTTPServer       brain_pkg_resources math                string
Canvas              brain_pytest        matplotlib          stringold
...
...

If you want to get the list of installed modules in your terminal, you can use the Python package manager, pip. For example,

$ pip freeze

You will get the output:

asn1crypto==0.22.0
astroid==1.5.2
attrs==16.3.0
Automat==0.5.0
backports.functools-lru-cache==1.3
cffi==1.10.0
...

If you have pip version >= 1.3, you can also use pip list. For example,

$ pip list
asn1crypto (0.22.0)
astroid (1.5.2)
attrs (16.3.0)
Automat (0.5.0)
backports.functools-lru-cache (1.3)
...
...
raja
Published on 19-Dec-2017 13:31:21
Advertisements