2

Usually, after doing numerical SciPy/NumPy calculations in the interactive mode for several hours, a bunch of modules become to be loaded.

Are there any good ways to see the list of imported modules from the interactive python command line?

Thanks!

chanwcom
  • 3,952
  • 6
  • 33
  • 43
  • 3
    import sys; sys.modules.keys()​​​. For a more refined solution see http://stackoverflow.com/questions/4858100/how-to-list-imported-modules –  Aug 26 '15 at 20:26

2 Answers2

3

Use sys.modules:

import sys
print '\n'.join(sys.modules)
Daniel
  • 40,885
  • 4
  • 53
  • 79
-1

Use Pip

pip freeze

Using:

pip freeze > requirements.txt 

will save all the modelues in a text file.

Wtower
  • 17,145
  • 11
  • 98
  • 72
Thuruv
  • 78
  • 9
  • 2
    That lists all *installed* modules, while the question is about listing the modules currently *imported* in a running process. – jwodder Aug 26 '15 at 20:43