การขโมยจาก @Lila (ไม่สามารถแสดงความคิดเห็นได้เนื่องจากไม่มีการจัดรูปแบบ) สิ่งนี้จะแสดงโมดูล / เส้นทาง / ของเช่นกัน:
#!/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()
ซึ่งผลิต:
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
...
.. เหมาะสำหรับ grepping หรือสิ่งที่คุณมี ถูกเตือนมันยาว!