python 查找模块的文件路径

来源:互联网 发布:吉林动画学院网络教育 编辑:程序博客网 时间:2024/05/22 11:56

有时候想知道import的模块的文件路径,看看脚本,可以通过以下方式来查看:

Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import identmodule>>> print identmodule.__file__/usr/lib/python2.6/site-packages/identmodule/__init__.pyc

通过模块的__file__属性来确定,这时候进入/usr/lib/python2.6/site-packages/identmodule/ 目录就可以查看脚本了

1 0
原创粉丝点击