How to get current import paths in Python?

后端 未结 4 576
Happy的楠姐
Happy的楠姐 2020-12-08 03:50

I get an ImportError exception somewhere in the code, but the same module can be imported safely at startup of the application. I\'m curious to see which paths

4条回答
  •  旧时难觅i
    2020-12-08 04:34

    The path locations that python checks by default can be inspected by checking sys.path.

    import sys
    print(sys.path)
    

提交回复
热议问题