chanwcom
chanwcom

Reputation: 4650

What is the best way of listing all imported modules in python?

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!

Upvotes: 2

Views: 345

Answers (2)

Thuruv
Thuruv

Reputation: 78

Use Pip

pip freeze

Using:

pip freeze > requirements.txt 

will save all the modelues in a text file.

Upvotes: -1

Daniel
Daniel

Reputation: 42758

Use sys.modules:

import sys
print '\n'.join(sys.modules)

Upvotes: 3

Related Questions