Wednesday, August 13, 2014

Checking installed python modules

To check the installed python modules, there are 2 ways:

  1. run help('modules') command in the python shell, as below:
    • $ python
      Python 2.6.6 (r266:84292, Sep 11 2012, 08:28:27)
      [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> help ('modules')
      Please wait a moment while I gather a list of all available modules...
      BaseHTTPServer      cProfile            imghdr              robotparser
      Bastion             cStringIO           imp                 rpm
      CDROM               cairo               imputil             rpmUtils
  2. and if you need to filter your search, running it directly from linux shell is the best, where you can use grep as below to filter your search, where -c is the flag for running a python command
    • $ python -c "help('modules')" | grep token
      _socket             future_builtins     pipes               token
      _sqlite3            gc                  pkg_resources       tokenize

No comments: