Where are the python modules stored?

后端 未结 7 2040
说谎
说谎 2020-12-02 11:08

I have recently started learning Python and I have 2 questions relating to modules.

  1. Is there a way to obtain a list of Python modules available (i.e. installed
7条回答
  •  长情又很酷
    2020-12-02 11:32

    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
    

提交回复
热议问题