Where are python modules stored?

I'm new to this and wondering where is all the code for modules and packages and stuff that you can import located on my computer.

Can anyone give me a short tutorial and help me?

+3


source to share


1 answer


Let's say you want to know the location of a module xyz

. You do it on the interpreter

>>> import xyx
>>> xyz.__file__

      

You will get the location of the file pyc

where your module is imported from.

You can also just do

>>> xyz

      



to get the module name and module location.

To find out about all the possible places where modules are imported from, do this.

>>> import sys
>>> sys.path

      

This will give you a list of places where Python is looking for the module when you do import

.

Hope it helps.

+3


source







All Articles