Where are the python modules stored?

后端 未结 7 2002
说谎
说谎 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:28

    1. You can iterate through directories listed in sys.path to find all modules (except builtin ones).
    2. It'll probably be somewhere around /usr/lib/pythonX.X/site-packages (again, see sys.path). And consider using native Python package management (via pip or easy_install, plus yolk) instead, packages in Linux distros-maintained repositories tend to be outdated.

提交回复
热议问题