问题
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!
回答1:
Use sys.modules
:
import sys
print '\n'.join(sys.modules)
回答2:
Use Pip
pip freeze
Using:
pip freeze > requirements.txt
will save all the modelues in a text file.
来源:https://stackoverflow.com/questions/32236052/what-is-the-best-way-of-listing-all-imported-modules-in-python