使用
-v参数启动python以启用调试输出。当您导入模块时,Python将打印出模块从以下位置导入的位置:
$ python -v...>>> import re# /usr/lib/python2.6/re.pyc matches /usr/lib/python2.6/re.pyimport re # precompiled from /usr/lib/python2.6/re.pyc...
如果您还想查看Python在其他什么地方搜索了该模块,请添加第二个
-v:
$ python -v -v...>>> import re# trying re.so# trying remodule.so# trying re.py# trying re.pyc# trying /usr/lib/python2.6/re.so# trying /usr/lib/python2.6/remodule.so# trying /usr/lib/python2.6/re.py# /usr/lib/python2.6/re.pyc matches /usr/lib/python2.6/re.pyimport re # precompiled from /usr/lib/python2.6/re.pyc...



