191 Contributors: 1 Sunday, July 9, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial:
Roadmap: roadmap

Usage of "pip" module: PyPI Package Manager


Sometimes you may need to use pip package manager inside python eg. when some imports may raise ImportError and you want to handle the exception. If you unpack on Windows Python_root/Scripts/pip.exeinside is stored file, where main class from pip package is imported. This means pip package is used whenever you use pip executable. For usage of pip as executable see: pip: PyPI Package Manager


  • 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 not failed than returns 0
    • parseopts(args)
      • param args {list}
    • get_installed_distributions()
      • returns {list}
    • get_similar_commands(name)
      • Command name auto-correct.
      • param name {string}
      • returns {boolean}
    • 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}

Related Examples