Where is module being imported from?

前端 未结 8 1376
余生分开走
余生分开走 2020-12-07 19:57

Assuming I have two Python modules and path_b is in the import path:

# file: path_b/my_module.py
print \"I was imported from ???\"

#file: path_a/app.py
impo         


        
8条回答
  •  一向
    一向 (楼主)
    2020-12-07 20:30

    If you want to see where a module is stored, for example setuptools, type in shell:

    $ python -c "import setuptools; print(setuptools.__file__)"

提交回复
热议问题