You may see this error when trying to use pip on Windows. The most command reason for getting this error is that pip is not installed as a normal application on windows, and can’t be run by itself from the command line. Instead, PIP needs to be run from a python command.
Here are two ways to use PIP from the command line.
Use PIP without adding it to windows PATH
To use pip without any other configuration, find the location of your Python installation. You can do this by searching for Python in the start menu, and then right clicking on Python 3.7 (or whatever version your using) and then clicking open file location.
This will open an Explorer window with a shortcut to the Python executable. Repeat the step above to go to the location of the shortcut.
Now, with a CMD window open, you can drag and drop the .exe file to the command window. This will copy the path to the window. You can now type
-m pip followed by your pip command. For example, to update pip it would look like
C:\\path\to\python.exe -m pip install --upgrade pip. Easy as that!
However, you will quickly notice that dragging python.exe on to a command window will quickly get tiring. Adding Python as a PATH variable will fix this issue.
Use PIP by adding Python to PATH
After adding Python as a path variable, you will no longer need to copy and paste the entire path to Python.exe. Instead, you can omit the path entirely and just type
python -m pip followed by the pip command. For example
python -m pip install --upgrade pip.