在python中列出所有导入的模块的最佳方法是什么? [英] What is the best way of listing all imported modules in python?

查看:302
本文介绍了在python中列出所有导入的模块的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,在交互模式下进行数值SciPy/NumPy计算几个小时后,就会加载一堆模块.

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

有什么好的方法可以从交互式python命令行查看导入的模块列表吗?

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

谢谢!

推荐答案

使用sys.modules:

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

这篇关于在python中列出所有导入的模块的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆