Usage of pip module PyPI Package Manager
suggest changeIntroduction
Sometimes you may need to use the pip package manager from Python, for example when an import raises ImportError and you want to handle the exception. The Windows launcher Python_root/Scripts/pip.exe calls the main function in the pip package. That function is an internal entry point for pip’s own console scripts, not a supported library API, and calling it warns that this wrapper will fail in a future pip. For usage of pip as an executable see: pip: PyPI Package Manager
Syntax
The names below are the old top-level pip helpers. Current pip exposes only main on the pip package. The other helpers have moved under pip._internal or been removed.
- pip.<function|attribute|class> where function is one of:
- autocomplete()
- Command and option completion for the main option parser (and options) and its subcommands (and options). Enable by sourcing one of the completion shell scripts (bash, zsh or fish).
- check_isolated(args)
- param args {list}
- returns {boolean}
- create_main_parser()
- returns {pip.baseparser.ConfigOptionParser object}
- main(args=None)
- param args {list}
- returns {integer} If it does not fail, it returns 0
- parseopts(args)
- param args {list}
- get_installed_distributions()
- returns {list} Removed from current pip; calling it raises AttributeError.
- get_similar_commands(name)
- Command name auto-correct.
- param name {string}
- returns a similar command name, or None
- get_summaries(ordered=True)
- Yields sorted (command name, command summary) tuples.
- get_prog()
- returns {string}
- dist_is_editable(dist)
- Is distribution an editable install?
- param dist {object}
- returns {boolean}
- commands_dict
- attribute {dictionary}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents