Ăn cắp từ @Lila (không thể đưa ra nhận xét vì không có định dạng), điều này cũng cho thấy / path / của mô-đun:
#!/usr/bin/env python
import sys
from modulefinder import ModuleFinder
finder = ModuleFinder()
# Pass the name of the python file of interest
finder.run_script(sys.argv[1])
# This is what's different from @Lila's script
finder.report()
sản xuất:
Name File
---- ----
...
m token /opt/rh/rh-python35/root/usr/lib64/python3.5/token.py
m tokenize /opt/rh/rh-python35/root/usr/lib64/python3.5/tokenize.py
m traceback /opt/rh/rh-python35/root/usr/lib64/python3.5/traceback.py
...
.. thích hợp để grepping hoặc những gì có bạn. Được cảnh báo, nó dài!