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
  • 4,420
  • 8
  • 37
  • 49
  • 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
  • 42,087
  • 4
  • 55
  • 81
-1

Use Pip

pip freeze

Using:

pip freeze > requirements.txt 

will save all the modelues in a text file.

Wtower
  • 18,848
  • 11
  • 103
  • 80
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