Where are the python modules stored?
- Is there a way to obtain a list of Python modules available (i.e. installed) on a machine?
This works for me:
help('modules')
- Where is the module code actually stored on my machine?
Usually in /lib/site-packages
in your Python folder. (At least, on Windows.)
You can use sys.path
to find out what directories are searched for modules.
On python command line, first import that module for which you need location.
import module_name
Then type:
print(module_name.__file__)
For example to find out "pygal" location:
import pygal
print(pygal.__file__)
Output:
/anaconda3/lib/python3.7/site-packages/pygal/__init__.py