Closed nikhiljohn10 closed 3 years ago
As I've written in https://github.com/DjangoGirls/tutorial/pull/1683#issuecomment-727189372, I don't think python -m pip ...
vs. just pip ...
was a Windows specific issue. If possible, I'd prefer to keep the instructions for different operating systems the same. So I think we should:
python -m
on Windows, MacOS and Linuxpython -m
in the common instruction for all three, or remove it from that common instructionAs far as I know, I use Linux at home and Mac at the office and both work well with pip install -U pip
. I really do not like programming on a windows pc unless it's just HTML and CSS. So I have to test it. I'll let you know the result.
(myvenv) C:\Users\me\Desktop\mysite>pip -V
pip 20.2.3 from c:\users\me\desktop\mysite\myvenv\lib\site-packages\pip (python 3.9)
(myvenv) C:\Users\me\Desktop\mysite>python -m pip -V
pip 20.2.3 from C:\Users\me\Desktop\mysite\myvenv\lib\site-packages\pip (python 3.9)
(myvenv) C:\Users\me\Desktop\mysite>pip install -U pip
Collecting pip
Using cached pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\me\\AppData\\Local\\Temp\\pip-uninstall-o1mvxqmn\\pip.exe'
Consider using the `--user` option or check the permissions.
(myvenv) C:\Users\me\Desktop\mysite>pip install --user -U pip
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
(myvenv) C:\Users\me\Desktop\mysite>python -m pip install -U pip
Collecting pip
Using cached pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
Successfully installed pip-20.2.4
@das-g The above result I got from testing Python and Pip concludes that the problem still exists in Windows OS. Thus the proposed changes in this PR are necessary for Windows users.
Researching why that might be, I've now read Why you should use python -m pip
.
It explains why pip install -U pip
doesn't work on Windows (not even with the virtual environment activated, even though the pip
from the virtual environment is being used) and, as the title says, why one should use python -m pip
instead of just pip
even when not on Windows and even when working with virtual environments. TL;DR:
pip
(and by extension, for which Python pip
will install the packages)Therefore: Sorry for the back and forth, but I now think we should stick to the python -m pip
way to call pip
for all operating systems.
pip command update
Ref: https://github.com/DjangoGirls/tutorial/pull/1683#issuecomment-727185235 by @das-g