Python Language Usage of "pip" module: PyPI Package Manager

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

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 __main__.py 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

Syntax

  • 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}


Got any Python Language Question?