Where can I find the full list of packages in python 3.x.
I have been searching on google - couple of web-site, but neither lists the full list.
Please help.
Thanks,
CodePudding user response:
While there will never be a list of every single library ever made for Python due to there being no single centralized distributing system, there's a couple of places you can always check:
Python standard library for the packages included with a Python install: https://docs.python.org/3/library/
Python package index for at least most of the commonly used libraries: https://pypi.org/
CodePudding user response:
You can use
sys.module
to view already imported modules. See the doc.If you want to see all available modules, not just the already imported ones, there is no such mechanism. But you could search for relevant folders and directories in the paths python will search to import modules, and guess which files/directories actually represent a python module (e.g. which files ends with
.py
, which dirs have a__init__.py
… The list of search paths is insys.path
. So you could doimport sys, os for python_search_path in sys.path: for item in os.listdir(python_search_path): module_file_candidate = os.path.join(python_search_path, item) # Test if module_file_candidate is a path to a module file/directory
To do the check, you could use the help of the import module,
importlib
, and function likeimportlib.util.find_spec
,importlib.machinery.SourceFileLoader.is_package()
orimportlib.machinery.all_suffixes()
If you install all you extraneous packages with pip, you can get them also with
pip list
in a shell or by usingsubprocess.check_output(["python", "-m", "pip", "list"])
Package Version
------------------ ---------
algdeps 4.3.0
backoff 1.11.1
certifi 2021.10.8
charset-normalizer 2.0.9
docopt 0.6.2
idna 3.3
importlib-metadata 4.8.2
keyring 23.4.0
pip 22.0.4
pyparsing 3.0.6
pywin32-ctypes 0.2.0
requests 2.26.0
setuptools 58.1.0
urllib3 1.26.7
zipp 3.6.0