Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Lấy danh sách module Python cài local

Có nhiều cách lấy danh sách module Python cài local. Cách dễ nhất dùng Python shell:

>>> help('modules')
Please wait a moment while I gather a list of all available modules...
BaseHTTPServer   brain_nose   markupbase   stat
Bastion          brain_numpy  marshal      statvfs
CGIHTTPServer    brain_pkg_resources math      string
Canvas           brain_pytest matplotlib   stringold
... ...

Muốn list trong terminal, dùng pip:

$ pip freeze

Output:

asn1crypto==0.22.0
astroid==1.5.2
attrs==16.3.0
Automat==0.5.0
backports.functools-lru-cache==1.3
cffi==1.10.0
...

Nếu pip version >= 1.3, cũng dùng pip list:

$ pip list
asn1crypto (0.22.0)
astroid (1.5.2)
attrs (16.3.0)
Automat (0.5.0)
backports.functools-lru-cache (1.3)
... ...