如何知道Python中模块的导入器是什么?

How to know what is the importer of a module in Python?

如何知道模块的导入节点路径?

例如,如果我这样做

import xxx.xxx

然后模块 yyy 以某种方式被导入。

如何知道yyy的导入路径?像

xxx.xxx -> zzz -> aaa -> yyy

如果您使用 -vv 标志启动 Python,那么您将看到详细的日志,包括它尝试导入的所有内容。

只是为了知道路径使用 python 只需使用

import sys
print(sys.path)

仅当您想手动浏览库时才检查站点包中可用的所有模块