bpo-22295: use python -m pip rather than plain pip in more examples (GH-24003)

This commit is contained in:
Ville Skyttä 2022-04-09 21:37:01 +03:00 committed by GitHub
parent f52d987abf
commit dc14e33eff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View file

@ -43,7 +43,7 @@ something into it:
$ python3 -m venv example $ python3 -m venv example
$ source example/bin/activate $ source example/bin/activate
(example) $ pip install wheel (example) $ python -m pip install wheel
You can get the version string for ``wheel`` by running the following: You can get the version string for ``wheel`` by running the following:

View file

@ -721,7 +721,7 @@ Substantially all of these recipes and many, many others can be installed from
the `more-itertools project <https://pypi.org/project/more-itertools/>`_ found the `more-itertools project <https://pypi.org/project/more-itertools/>`_ found
on the Python Package Index:: on the Python Package Index::
pip install more-itertools python -m pip install more-itertools
The extended tools offer the same high performance as the underlying toolset. The extended tools offer the same high performance as the underlying toolset.
The superior memory performance is kept by processing elements one at a time The superior memory performance is kept by processing elements one at a time

View file

@ -130,8 +130,8 @@ package name followed by ``==`` and the version number:
If you re-run this command, ``pip`` will notice that the requested If you re-run this command, ``pip`` will notice that the requested
version is already installed and do nothing. You can supply a version is already installed and do nothing. You can supply a
different version number to get that version, or you can run ``pip different version number to get that version, or you can run ``python
install --upgrade`` to upgrade the package to the latest version: -m pip install --upgrade`` to upgrade the package to the latest version:
.. code-block:: bash .. code-block:: bash
@ -143,14 +143,14 @@ install --upgrade`` to upgrade the package to the latest version:
Successfully uninstalled requests-2.6.0 Successfully uninstalled requests-2.6.0
Successfully installed requests-2.7.0 Successfully installed requests-2.7.0
``pip uninstall`` followed by one or more package names will remove the ``python -m pip uninstall`` followed by one or more package names will
packages from the virtual environment. remove the packages from the virtual environment.
``pip show`` will display information about a particular package: ``python -m pip show`` will display information about a particular package:
.. code-block:: bash .. code-block:: bash
(tutorial-env) $ pip show requests (tutorial-env) $ python -m pip show requests
--- ---
Metadata-Version: 2.0 Metadata-Version: 2.0
Name: requests Name: requests
@ -163,25 +163,25 @@ packages from the virtual environment.
Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages
Requires: Requires:
``pip list`` will display all of the packages installed in the virtual ``python -m pip list`` will display all of the packages installed in
environment: the virtual environment:
.. code-block:: bash .. code-block:: bash
(tutorial-env) $ pip list (tutorial-env) $ python -m pip list
novas (3.1.1.3) novas (3.1.1.3)
numpy (1.9.2) numpy (1.9.2)
pip (7.0.3) pip (7.0.3)
requests (2.7.0) requests (2.7.0)
setuptools (16.0) setuptools (16.0)
``pip freeze`` will produce a similar list of the installed packages, ``python -m pip freeze`` will produce a similar list of the installed packages,
but the output uses the format that ``pip install`` expects. but the output uses the format that ``python -m pip install`` expects.
A common convention is to put this list in a ``requirements.txt`` file: A common convention is to put this list in a ``requirements.txt`` file:
.. code-block:: bash .. code-block:: bash
(tutorial-env) $ pip freeze > requirements.txt (tutorial-env) $ python -m pip freeze > requirements.txt
(tutorial-env) $ cat requirements.txt (tutorial-env) $ cat requirements.txt
novas==3.1.1.3 novas==3.1.1.3
numpy==1.9.2 numpy==1.9.2