Find which python modules are being imported

后端 未结 4 793
有刺的猬
有刺的猬 2021-01-31 08:16

What\'s an easy way of finding all the python modules from a particular package that are being used in an application?

4条回答
  •  迷失自我
    2021-01-31 08:37

    sys.modules is a dictionary mapping module names to modules. You can examine its keys to see imported modules.

    See: http://docs.python.org/library/sys.html#sys.modules

提交回复
热议问题