#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...` ------------------------------------------------+------------------------ Reporter: Ramiro Morales | Owner: nobody Type: Cleanup/optimization | Status: new Component: Documentation | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | ------------------------------------------------+------------------------ Perhaps a minor detail in these times in which Django is Python3-only and usage of some form of virtualenv/minimal container is ubiquitous. But posting for consideration anyways just in case.
Using `python -m pip install foo`makes sure the copy of `pip` looked up and executed is the one installed for the interpreter copy currently in use (be it a system-wide or a virtualenv's) This reduces the chances of failure (wrong `pip`gets used and the install fails confusing the user or even worse the intended install action succeeds but against another copy of Python) in broken setups in which a leftover Python2 `pip` or one associated with a different Python 3.x install is located in a directory which appears earlier in `$PATH`. Inspired by this article by Brett Cannon: https://snarky.ca /deconstructing-xkcd-com-1987/ Quoting: > Having `pip` installed is not a shocker. The real question is ''what'' interpreter pip is attached to? That's dependent on which Python interpreter was installed '''last''' in the ''earliest'' directory to have a Python interpreter in it. This is why you should always use `python -m pip` when executing pip to guarantee you are using pip with the interpreter you intend to install for. -- Ticket URL: <https://code.djangoproject.com/ticket/30367> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/049.fcf3c397165c5f63a776aa7a4eab8e9b%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.