View installed modules of python under linux

1. Use the pydoc command on the command line

        Run it on the command line $ pydoc modulesto see

2. Use help() to view in the python interactive interpreter

        python---> just type in the interactive interpreter , the effect is the same as >>> help("modules")typing in the command line$ pydoc modules

3. Import the sys module under the python interpreter to view

  Python's sys module can also be used to view module information

>>> import sys >>> sys.modules.keys()

Fourth, use pip to view under the command line

    If you are using pip as your python package manager, you can run it directly on the command line $ pip freezeor $ pip listview the information about the installed package. Of course, other package managers have similar functions. At the same time, you can also interact with python Import the pip module into the interpreter to view package information

import pip installed_packages = pip.get_installed_distributions() installed_packages_list = sorted(["%s==%s" % (i.key, i.version) for i in installed_packages]) print(installed_packages_list) 5. Use yolk to view

    If you have installed yolk, you can use the yolk command to view the package information, you can use $ pip install yolkto install it 

yolk is easy to use, just operate on the command line

$ yolk -l #列出所有安装模块 $ yolk -a #列出激活的模块 $ yolk -n #列出非激活模块 $ yolk -U [packagename] # 通过查询pypi来查看(该)模块是否有新版本






Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325715769&siteId=291194637