3

I've recently reinstalled windows on my workstation so I needed to reinstall python and pip, before the reinstallation, the command pip install whatever was working properly. But then after the reinstallation of Windows 10 when I type that command it won't return anything, not even an error, I've searched other solution and I found that this command python -m pip install whatever works fine.

What is changed?

How can I let the first command work again?

Gargantua
  • 420
  • 2
  • 5
  • 17

4 Answers4

3

This is a PATH problem. On a standard Python3 installation on Windows, python.exe and pip.exe are in different folders. Let us say that Python is installed just under TOP, then:

  • python.exe (and pythonw.exe) are in TOP\Python3x (x being minor version such as Python37)
  • pip.exe is in TOP\Python3x\Scripts
  • py.exe is in WINDOWSDIR (normally C:\Windows)

That is the reason why:

  • py -m pip install ... always works on Windows (provided pip is installed)
  • python -m pip install ... requires ...\Python3x to be in the PATH
  • pip install ... requires ...\Python3x\Scripts to be in the PATH
Serge Ballesta
  • 143,923
  • 11
  • 122
  • 252
1

pip is a python script, and because you have not added to path variable the link to the "Scripts" folder; this "Scripts" folder is situated on "C:location where python is installed\Scripts";

ex. for me : "C:\Python36\Scripts"; so i type on cmd prompt to set the path variable:

set PATH=%PATH%;C:\Python36\Scripts

you can see the link: [https://www.computerhope.com/issues/ch000549.htm]

1

As Bensalem has said, you need to add pip to your variable path in order to be able to use it without calling the script with python (which is in your path).

The -m refers to the passable argument to python;

-m mod : run library module as a script (terminates option list)

Nordle
  • 2,915
  • 3
  • 16
  • 34
0

you should add pip to ur environment variable(path windows), try this

Lau Real
  • 317
  • 1
  • 4
  • 15