Skip to content

Commit 485adbe

Browse files
authored
Merge pull request #808 from scop/python-m-pip
Use `python -m pip` instead of just `pip` in pip invocations
2 parents ed312c7 + 4cf076e commit 485adbe

18 files changed

Lines changed: 67 additions & 67 deletions

source/contribute.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ need:
7979
1. `Nox <https://nox.readthedocs.io/en/latest/>`_. You can install or upgrade
8080
nox using ``pip``::
8181

82-
pip install --user nox
82+
python -m pip install --user nox
8383

8484
2. Python 3.6. Our build scripts are designed to work with Python 3.6 only.
8585
See the `Hitchhiker's Guide to Python installation instructions`_ to install

source/discussions/install-requires-vs-requirements.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ packages. [1]_
8383

8484
Whereas ``install_requires`` metadata is automatically analyzed by pip during an
8585
install, requirements files are not, and only are used when a user specifically
86-
installs them using ``pip install -r``.
86+
installs them using ``python -m pip install -r``.
8787

8888
----
8989

source/discussions/pip-vs-easy-install.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Here's a breakdown of the important differences between pip and easy_install now
2727
|Installs from :term:`Wheels |Yes |No |
2828
|<Wheel>` | | |
2929
+------------------------------+--------------------------------------+-------------------------------+
30-
|Uninstall Packages |Yes (``pip uninstall``) |No |
30+
|Uninstall Packages |Yes (``python -m pip uninstall``) |No |
3131
+------------------------------+--------------------------------------+-------------------------------+
3232
|Dependency Overrides |Yes (:ref:`Requirements Files |No |
3333
| |<pip:Requirements Files>`) | |
3434
+------------------------------+--------------------------------------+-------------------------------+
35-
|List Installed Packages |Yes (``pip list`` and ``pip |No |
36-
| |freeze``) | |
35+
|List Installed Packages |Yes (``python -m pip list`` and |No |
36+
| |``python -m pip freeze``) | |
3737
+------------------------------+--------------------------------------+-------------------------------+
3838
|:pep:`438` |Yes |No |
3939
|Support | | |

source/guides/analyzing-pypi-package-downloads.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ Install `pypinfo`_ using pip.
274274

275275
::
276276

277-
pip install pypinfo
277+
python -m pip install pypinfo
278278

279279
Usage:
280280

source/guides/distributing-packages-using-setuptools.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Requirements for packaging and distributing
3232

3333
::
3434

35-
pip install twine
35+
python -m pip install twine
3636

3737
You'll need this to upload your project :term:`distributions <Distribution
3838
Package>` to :term:`PyPI <Python Package Index (PyPI)>` (see :ref:`below
@@ -667,7 +667,7 @@ Assuming you're in the root of your project directory, then run:
667667

668668
::
669669

670-
pip install -e .
670+
python -m pip install -e .
671671

672672

673673
Although somewhat cryptic, ``-e`` is short for ``--editable``, and ``.`` refers
@@ -699,7 +699,7 @@ see the :ref:`VCS Support <pip:VCS Support>` section of the pip docs.
699699

700700
Lastly, if you don't want to install any dependencies at all, you can run::
701701

702-
pip install -e . --no-deps
702+
python -m pip install -e . --no-deps
703703

704704

705705
For more information, see the `Development Mode
@@ -759,7 +759,7 @@ Before you can build wheels for your project, you'll need to install the
759759

760760
.. code-block:: text
761761
762-
pip install wheel
762+
python -m pip install wheel
763763
764764
765765
.. _`Universal Wheels`:

source/guides/dropping-older-python-versions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Ensure that before you generate source distributions or binary distributions, yo
3232

3333
Steps::
3434

35-
pip install --upgrade setuptools twine
35+
python -m pip install --upgrade setuptools twine
3636

3737
`setuptools` version should be above 24.0.0.
3838

source/guides/hosting-your-own-index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In either case, since you'll be hosting a repository that is likely not in
1414
your user's default repositories, you should instruct them in your project's
1515
description to configure their installer appropriately. For example with pip::
1616

17-
pip install --extra-index-url https://python.example.com/ foobar
17+
python -m pip install --extra-index-url https://python.example.com/ foobar
1818

1919
In addition, it is **highly** recommended that you serve your repository with
2020
valid HTTPS. At this time, the security of your user's installations depends on

source/guides/index-mirrors-and-caches.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ cached copies of :term:`packages <Distribution Package>`:
3434
by downloading all the requirements for a project and then pointing pip at
3535
those downloaded files instead of going to PyPI.
3636
2. A variation on the above which pre-builds the installation files for
37-
the requirements using `pip wheel
37+
the requirements using `python -m pip wheel
3838
<https://pip.readthedocs.io/en/latest/reference/pip_wheel.html>`_::
3939

40-
$ pip wheel --wheel-dir=/tmp/wheelhouse SomeProject
41-
$ pip install --no-index --find-links=/tmp/wheelhouse SomeProject
40+
$ python -m pip wheel --wheel-dir=/tmp/wheelhouse SomeProject
41+
$ python -m pip install --no-index --find-links=/tmp/wheelhouse SomeProject
4242

4343

4444
Caching with devpi

source/guides/installing-stand-alone-command-line-tools.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ To upgrade or uninstall the package
8787

8888
::
8989

90-
$ pip install -U pipx
91-
$ pip uninstall pipx
90+
$ python3 -m pip install -U pipx
91+
$ python3 -m pip uninstall pipx
9292

9393
``pipx`` also allows you to install and run the latest version of a cli tool
9494
in a temporary, ephemeral environment.

source/guides/installing-using-pip-and-virtual-environments.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Now that you're in your virtual environment you can install packages. Let's inst
188188

189189
.. code-block:: bash
190190
191-
pip install requests
191+
python3 -m pip install requests
192192
193193
pip should download requests and all of its dependencies and install them:
194194

@@ -219,19 +219,19 @@ a specific version of ``requests``:
219219

220220
.. code-block:: bash
221221
222-
pip install requests==2.18.4
222+
python3 -m pip install requests==2.18.4
223223
224224
To install the latest ``2.x`` release of requests:
225225

226226
.. code-block:: bash
227227
228-
pip install requests>=2.0.0,<3.0.0
228+
python3 -m pip install requests>=2.0.0,<3.0.0
229229
230230
To install pre-release versions of packages, use the ``--pre`` flag:
231231

232232
.. code-block:: bash
233233
234-
pip install --pre requests
234+
python3 -m pip install --pre requests
235235
236236
237237
Installing extras
@@ -242,7 +242,7 @@ specifying the extra in brackets:
242242

243243
.. code-block:: bash
244244
245-
pip install requests[security]
245+
python3 -m pip install requests[security]
246246
247247
.. _extras:
248248
https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
@@ -256,15 +256,15 @@ pip can install a package directly from source, for example:
256256
.. code-block:: bash
257257
258258
cd google-auth
259-
pip install .
259+
python3 -m pip install .
260260
261261
Additionally, pip can install packages from source in `development mode`_,
262262
meaning that changes to the source directory will immediately affect the
263263
installed package without needing to re-install:
264264

265265
.. code-block:: bash
266266
267-
pip install --editable .
267+
python3 -m pip install --editable .
268268
269269
270270
.. _development mode:
@@ -293,15 +293,15 @@ wheel, or tar file) you can install it directly with pip:
293293

294294
.. code-block:: bash
295295
296-
pip install requests-2.18.4.tar.gz
296+
python3 -m pip install requests-2.18.4.tar.gz
297297
298298
If you have a directory containing archives of multiple packages, you can tell
299299
pip to look for packages there and not to use the
300300
:term:`Python Package Index (PyPI)` at all:
301301

302302
.. code-block:: bash
303303
304-
pip install --no-index --find-links=/local/dir/ requests
304+
python3 -m pip install --no-index --find-links=/local/dir/ requests
305305
306306
This is useful if you are installing packages on a system with limited
307307
connectivity or if you want to strictly control the origin of distribution
@@ -316,15 +316,15 @@ If you want to download packages from a different index than the
316316

317317
.. code-block:: bash
318318
319-
pip install --index-url http://index.example.com/simple/ SomeProject
319+
python3 -m pip install --index-url http://index.example.com/simple/ SomeProject
320320
321321
If you want to allow packages from both the :term:`Python Package Index (PyPI)`
322322
and a separate index, you can use the ``--extra-index-url`` flag instead:
323323

324324

325325
.. code-block:: bash
326326
327-
pip install --extra-index-url http://index.example.com/simple/ SomeProject
327+
python3 -m pip install --extra-index-url http://index.example.com/simple/ SomeProject
328328
329329
330330
Upgrading packages
@@ -335,7 +335,7 @@ install the latest version of ``requests`` and all of its dependencies:
335335

336336
.. code-block:: bash
337337
338-
pip install --upgrade requests
338+
python3 -m pip install --upgrade requests
339339
340340
341341
Using requirements files
@@ -354,7 +354,7 @@ And tell pip to install all of the packages in this file using the ``-r`` flag:
354354

355355
.. code-block:: bash
356356
357-
pip install -r requirements.txt
357+
python3 -m pip install -r requirements.txt
358358
359359
360360
Freezing dependencies
@@ -365,7 +365,7 @@ Pip can export a list of all installed packages and their versions using the
365365

366366
.. code-block:: bash
367367
368-
pip freeze
368+
python3 -m pip freeze
369369
370370
Which will output a list of package specifiers such as:
371371

0 commit comments

Comments
 (0)