diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py index 04f50e3f3d..8f12e80725 100644 --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -377,7 +377,7 @@ class ImageField(FileField): checks.Error( 'Cannot use ImageField because Pillow is not installed.', hint=('Get Pillow at https://pypi.org/project/Pillow/ ' - 'or run command "pip install Pillow".'), + 'or run command "python -m pip install Pillow".'), obj=self, id='fields.E210', ) diff --git a/django/test/runner.py b/django/test/runner.py index eeae295704..4f755c8fc5 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -145,7 +145,7 @@ parallel test runner to handle this exception cleanly. In order to see the traceback, you should install tblib: - pip install tblib + python -m pip install tblib """.format(test, original_exc_txt)) else: print(""" diff --git a/docs/README b/docs/README index 4785eab70e..f34aa8782a 100644 --- a/docs/README +++ b/docs/README @@ -6,7 +6,7 @@ This allows it to be built into other forms for easier viewing and browsing. To create an HTML version of the docs: -* Install Sphinx (using ``pip install Sphinx`` or some other method) +* Install Sphinx (using ``python -m pip install Sphinx`` or some other method). * In this docs/ directory, type ``make html`` (or ``make.bat html`` on Windows) at a shell prompt. diff --git a/docs/howto/deployment/wsgi/gunicorn.txt b/docs/howto/deployment/wsgi/gunicorn.txt index 11451d59a4..bcdff4879e 100644 --- a/docs/howto/deployment/wsgi/gunicorn.txt +++ b/docs/howto/deployment/wsgi/gunicorn.txt @@ -12,7 +12,7 @@ dependencies and is easy to install and use. Installing Gunicorn =================== -Installing gunicorn is as easy as ``pip install gunicorn``. For more +Installing gunicorn is as easy as ``python -m pip install gunicorn``. For more details, see the `gunicorn documentation`_. .. _gunicorn documentation: https://docs.gunicorn.org/en/latest/install.html diff --git a/docs/howto/deployment/wsgi/uwsgi.txt b/docs/howto/deployment/wsgi/uwsgi.txt index a02c12f26c..20bf84be82 100644 --- a/docs/howto/deployment/wsgi/uwsgi.txt +++ b/docs/howto/deployment/wsgi/uwsgi.txt @@ -27,10 +27,10 @@ command. For example: .. code-block:: console # Install current stable version. - $ pip install uwsgi + $ python -m pip install uwsgi # Or install LTS (long term support). - $ pip install https://projects.unbit.it/downloads/uwsgi-lts.tar.gz + $ python -m pip install https://projects.unbit.it/downloads/uwsgi-lts.tar.gz .. _installation procedures: https://uwsgi-docs.readthedocs.io/en/latest/Install.html diff --git a/docs/howto/outputting-pdf.txt b/docs/howto/outputting-pdf.txt index 9950c4316c..34172f4087 100644 --- a/docs/howto/outputting-pdf.txt +++ b/docs/howto/outputting-pdf.txt @@ -26,7 +26,7 @@ You can install ReportLab with ``pip``: .. console:: - $ pip install reportlab + $ python -m pip install reportlab Test your installation by importing it in the Python interactive interpreter:: diff --git a/docs/howto/upgrade-version.txt b/docs/howto/upgrade-version.txt index d5bfeff3eb..a7ff10e710 100644 --- a/docs/howto/upgrade-version.txt +++ b/docs/howto/upgrade-version.txt @@ -93,7 +93,7 @@ If you installed Django with pip_, you can use the ``--upgrade`` or ``-U`` flag: .. console:: - $ pip install -U Django + $ python -m pip install -U Django .. _pip: https://pip.pypa.io/ .. _virtualenv: https://virtualenv.pypa.io/ diff --git a/docs/howto/windows.txt b/docs/howto/windows.txt index 0939ddd7c4..d624e13bff 100644 --- a/docs/howto/windows.txt +++ b/docs/howto/windows.txt @@ -50,7 +50,7 @@ each Django project you create. While not mandatory, this is considered a best practice and will save you time in the future when you're ready to deploy your project. Simply type:: - pip install virtualenvwrapper-win + python -m pip install virtualenvwrapper-win Then create a virtual environment for your project:: @@ -73,7 +73,7 @@ Django can be installed easily using ``pip`` within your virtual environment. In the command prompt, ensure your virtual environment is active, and execute the following command:: - pip install django + python -m pip install django This will download and install the latest Django release. @@ -93,8 +93,8 @@ Common pitfalls than one Python version installed. * If you are connecting to the internet behind a proxy, there might be problem - in running the command ``pip install django``. Set the environment variables - for proxy configuration in the command prompt as follows:: + in running the command ``python -m pip install django``. Set the environment + variables for proxy configuration in the command prompt as follows:: set http_proxy=http://username:password@proxyserver:proxyport set https_proxy=https://username:password@proxyserver:proxyport diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index 67602b87da..ab7cc0baa9 100644 --- a/docs/internals/contributing/writing-code/coding-style.txt +++ b/docs/internals/contributing/writing-code/coding-style.txt @@ -96,7 +96,7 @@ Imports .. console:: - $ pip install isort + $ python -m pip install isort $ isort -rc . This runs ``isort`` recursively from your current directory, modifying any diff --git a/docs/internals/contributing/writing-code/javascript.txt b/docs/internals/contributing/writing-code/javascript.txt index 941fa085e8..bcb83d18bc 100644 --- a/docs/internals/contributing/writing-code/javascript.txt +++ b/docs/internals/contributing/writing-code/javascript.txt @@ -55,7 +55,7 @@ version. To run it: .. console:: - $ pip install closure + $ python -m pip install closure $ python django/contrib/admin/bin/compress.py Behind the scenes, ``compress.py`` is a front-end for Google's diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt index 51d1e61313..e0369b5800 100644 --- a/docs/internals/contributing/writing-code/unit-tests.txt +++ b/docs/internals/contributing/writing-code/unit-tests.txt @@ -30,8 +30,8 @@ Next, clone your fork, install some requirements, and run the tests:: $ git clone git@github.com:YourGitHubName/django.git django-repo $ cd django-repo/tests - $ pip install -e .. - $ pip install -r requirements/py3.txt + $ python -m pip install -e .. + $ python -m pip install -r requirements/py3.txt $ ./runtests.py Installing the requirements will likely require some operating system packages @@ -68,7 +68,7 @@ and other checks (such as :ref:`import sorting `, the :ref:`code formatting `), install and run the ``tox`` command from any place in the Django source tree:: - $ pip install tox + $ python -m pip install tox $ tox By default, ``tox`` runs the test suite with the bundled test settings file for @@ -240,7 +240,7 @@ You can find these dependencies in `pip requirements files`_ inside the ``tests/requirements`` directory of the Django source tree and install them like so:: - $ pip install -r tests/requirements/py3.txt + $ python -m pip install -r tests/requirements/py3.txt If you encounter an error during the installation, your system might be missing a dependency for one or more of the Python packages. Consult the failing diff --git a/docs/internals/contributing/writing-documentation.txt b/docs/internals/contributing/writing-documentation.txt index acd8a3743b..09e0629a75 100644 --- a/docs/internals/contributing/writing-documentation.txt +++ b/docs/internals/contributing/writing-documentation.txt @@ -49,7 +49,7 @@ To build the documentation locally, install Sphinx: .. console:: - $ pip install Sphinx + $ python -m pip install Sphinx Then from the ``docs`` directory, build the HTML: diff --git a/docs/internals/howto-release-django.txt b/docs/internals/howto-release-django.txt index 4afc7a336c..d234400f8c 100644 --- a/docs/internals/howto-release-django.txt +++ b/docs/internals/howto-release-django.txt @@ -58,7 +58,7 @@ You'll need a few things before getting started: * An install of some required Python packages:: - $ pip install wheel twine + $ python -m pip install wheel twine * Access to Django's record on PyPI. Create a file with your credentials: @@ -305,10 +305,10 @@ Now you're ready to actually put the release out there. To do this: $ easy_install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz $ deactivate $ mktmpenv - $ pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz + $ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz $ deactivate $ mktmpenv - $ pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION-py3-none-any.whl + $ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION-py3-none-any.whl $ deactivate This just tests that the tarballs are available (i.e. redirects are up) and diff --git a/docs/intro/contributing.txt b/docs/intro/contributing.txt index e234612ef5..e5ca34b8e6 100644 --- a/docs/intro/contributing.txt +++ b/docs/intro/contributing.txt @@ -173,7 +173,7 @@ Go ahead and install the previously cloned copy of Django: .. console:: - $ pip install -e /path/to/your/local/clone/django/ + $ python -m pip install -e /path/to/your/local/clone/django/ The installed version of Django is now pointing at your local copy. You will immediately see any changes you make to it, which is of great help when writing @@ -195,7 +195,7 @@ Django ``tests/`` directory and then running: .. console:: - $ pip install -r requirements/py3.txt + $ python -m pip install -r requirements/py3.txt If you encounter an error during the installation, your system might be missing a dependency for one or more of the Python packages. Consult the failing diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt index 21b918a641..2777c0b104 100644 --- a/docs/intro/reusable-apps.txt +++ b/docs/intro/reusable-apps.txt @@ -280,14 +280,14 @@ working. We'll now fix this by installing our new ``django-polls`` package. #. To install the package, use pip (you already :ref:`installed it `, right?):: - pip install --user django-polls/dist/django-polls-0.1.tar.gz + python -m pip install --user django-polls/dist/django-polls-0.1.tar.gz #. With luck, your Django project should now work correctly again. Run the server again to confirm this. #. To uninstall the package, use pip:: - pip uninstall django-polls + python -m pip uninstall django-polls Publishing your app =================== diff --git a/docs/intro/whatsnext.txt b/docs/intro/whatsnext.txt index 718be49669..7b3a574f17 100644 --- a/docs/intro/whatsnext.txt +++ b/docs/intro/whatsnext.txt @@ -163,7 +163,7 @@ You can get a local copy of the HTML documentation following a few easy steps: .. console:: - $ pip install Sphinx + $ python -m pip install Sphinx * Then, just use the included ``Makefile`` to turn the documentation into HTML: diff --git a/docs/ref/contrib/gis/install/index.txt b/docs/ref/contrib/gis/install/index.txt index 924dec35f0..26019c98ab 100644 --- a/docs/ref/contrib/gis/install/index.txt +++ b/docs/ref/contrib/gis/install/index.txt @@ -316,7 +316,7 @@ psycopg2 After you've installed the KyngChaos binaries and modified your ``PATH``, as described above, ``psycopg2`` may be installed using the following command:: - $ pip install psycopg2 + $ python -m pip install psycopg2 .. note:: diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 41f5eefea5..0df57475ab 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1403,7 +1403,7 @@ correctly: .. code-block:: console - $ pip install tblib + $ python -m pip install tblib This feature isn't available on Windows. It doesn't work with the Oracle database backend either. diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index f4c29f4b72..ce39f4fa3e 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -1045,9 +1045,9 @@ When installing Django 1.9 or 1.9.1 with setuptools 5.5.x, you'll see:: It's safe to ignore these errors (Django will still install just fine), but you can avoid them by upgrading setuptools to a more recent version. If you're -using pip, you can upgrade pip using ``pip install -U pip`` which will also -upgrade setuptools. This is resolved in later versions of Django as described -in the :doc:`/releases/1.9.2`. +using pip, you can upgrade pip using ``python -m pip install -U pip`` which +will also upgrade setuptools. This is resolved in later versions of Django as +described in the :doc:`/releases/1.9.2`. Miscellaneous ------------- diff --git a/docs/topics/auth/passwords.txt b/docs/topics/auth/passwords.txt index 31d0dd9b4d..273ed33431 100644 --- a/docs/topics/auth/passwords.txt +++ b/docs/topics/auth/passwords.txt @@ -86,9 +86,10 @@ use of Argon2 rather than the other algorithms supported by Django. To use Argon2 as your default storage algorithm, do the following: -#. Install the `argon2-cffi library`_. This can be done by running ``pip - install django[argon2]``, which is equivalent to ``pip install argon2-cffi`` - (along with any version requirement from Django's ``setup.py``). +#. Install the `argon2-cffi library`_. This can be done by running + ``python -m pip install django[argon2]``, which is equivalent to + ``python -m pip install argon2-cffi`` (along with any version requirement + from Django's ``setup.py``). #. Modify :setting:`PASSWORD_HASHERS` to list ``Argon2PasswordHasher`` first. That is, in your settings file, you'd put:: @@ -115,9 +116,10 @@ use it Django supports bcrypt with minimal effort. To use Bcrypt as your default storage algorithm, do the following: -#. Install the `bcrypt library`_. This can be done by running ``pip install - django[bcrypt]``, which is equivalent to ``pip install bcrypt`` (along with - any version requirement from Django's ``setup.py``). +#. Install the `bcrypt library`_. This can be done by running + ``python -m pip install django[bcrypt]``, which is equivalent to + ``python -m pip install bcrypt`` (along with any version requirement from + Django's ``setup.py``). #. Modify :setting:`PASSWORD_HASHERS` to list ``BCryptSHA256PasswordHasher`` first. That is, in your settings file, you'd put:: diff --git a/docs/topics/install.txt b/docs/topics/install.txt index 4d762892f0..e947c2293a 100644 --- a/docs/topics/install.txt +++ b/docs/topics/install.txt @@ -155,7 +155,7 @@ This is the recommended way to install Django. .. console:: - $ pip install Django + $ python -m pip install Django .. _pip: https://pip.pypa.io/ .. _virtualenv: https://virtualenv.pypa.io/ @@ -214,7 +214,7 @@ latest bug fixes and improvements, follow these instructions: .. console:: - $ pip install -e django/ + $ python -m pip install -e django/ This will make Django's code importable, and will also make the ``django-admin`` utility command available. In other words, you're all diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt index b993ef4d0e..41c7f58745 100644 --- a/docs/topics/templates.txt +++ b/docs/topics/templates.txt @@ -385,7 +385,7 @@ Requires Jinja2_ to be installed: .. console:: - $ pip install Jinja2 + $ python -m pip install Jinja2 Set :setting:`BACKEND ` to ``'django.template.backends.jinja2.Jinja2'`` to configure a Jinja2_ engine. diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt index ea01bd026b..d9f508023c 100644 --- a/docs/topics/testing/tools.txt +++ b/docs/topics/testing/tools.txt @@ -920,7 +920,7 @@ Python path: .. console:: - $ pip install selenium + $ python -m pip install selenium Then, add a ``LiveServerTestCase``-based test to your app's tests module (for example: ``myapp/tests.py``). For this example, we'll assume you're using diff --git a/tests/README.rst b/tests/README.rst index 7f64afe6fc..86bd6987cf 100644 --- a/tests/README.rst +++ b/tests/README.rst @@ -2,8 +2,8 @@ To run the test suite, first, create and activate a virtual environment. Then install some requirements and run the tests:: $ cd tests - $ pip install -e .. - $ pip install -r requirements/py3.txt + $ python -m pip install -e .. + $ python -m pip install -r requirements/py3.txt $ ./runtests.py For more information about the test suite, see diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py index b1a289c977..a3231ee36a 100644 --- a/tests/invalid_models_tests/test_ordinary_fields.py +++ b/tests/invalid_models_tests/test_ordinary_fields.py @@ -631,7 +631,7 @@ class ImageFieldTests(SimpleTestCase): Error( 'Cannot use ImageField because Pillow is not installed.', hint=('Get Pillow at https://pypi.org/project/Pillow/ ' - 'or run command "pip install Pillow".'), + 'or run command "python -m pip install Pillow".'), obj=field, id='fields.E210', ), diff --git a/tox.ini b/tox.ini index 09a7ac8270..5e2f54fd78 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ # Tox (https://tox.readthedocs.io/) is a tool for running tests in multiple # virtualenvs. This configuration file helps to run the test suite on all -# supported Python versions. To use it, "pip install tox" and then run "tox" -# from this directory. +# supported Python versions. To use it, "python -m pip install tox" and +# then run "tox" from this directory. [tox] skipsdist = true