How do you determine which file is imported in Python with an “import” statement?
I want to determine that I am loading the correct version of a locally modified .py file. Basically the equivalent of “which” in a POSIX environment.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Start python with the
-vparameter to enable debugging output. When you then import a module, Python will print out where the module was imported from:If you additionally want to see in what other places Python searched for the module, add a second
-v: