Where are the python modules stored?

后端 未结 7 2042
说谎
说谎 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:45

    1) Using the help function

    Get into the python prompt and type the following command:

    >>>help("modules")
    

    This will list all the modules installed in the system. You don't need to install any additional packages to list them, but you need to manually search or filter the required module from the list.

    2) Using pip freeze

    sudo apt-get install python-pip
    pip freeze
    

    Even though you need to install additional packages to use this, this method allows you to easily search or filter the result with grep command. e.g. pip freeze | grep feed.

    You can use whichever method is convenient for you.

提交回复
热议问题