Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why "pip install" doesn't work but "python -m pip install" works?

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?

like image 323
Gargantua Avatar asked Oct 24 '25 00:10

Gargantua


1 Answers

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
like image 113
Serge Ballesta Avatar answered Oct 25 '25 14:10

Serge Ballesta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!