打印输出python3某一个包的具体位置

  1. import a_module
    print(a_module.__file__)

    however: AttributeError: 'module' object has no attribute '__file__'

  2. import inspect
    inspect.getfile(module)

    successful !

 

ref:

https://stackoverflow.com/questions/247770/how-to-retrieve-a-modules-path

posted @ 2021-06-29 14:36  略略略——  阅读(503)  评论(0编辑  收藏  举报