Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's an easy question to answer.

python -m pip is often advised over pip or /usr/bin/pip, because it uses the version of pip associated with that particular major+minor python install.

https://snarky.ca/why-you-should-use-python-m-pip/



Wait, but isn't the point of the article that it will not do that, and rather just run the pip.py in you current working directory?


Only in the (probably unlikely) case that you have a `pip.py` in your CWD. In all other cases, it will execute pip as intended.


In the off chance that you have one, yes.

But in 99.9999999% of cases it will do what you expect (whereas "pip install x" will be easier to use the wrong one if you have multiple Python versions).


Even with the other form, if pip imports anything named like a pyhon module in the dl dir, it will be imported. That's because the current dir is automatically added to the PATH, using -m only add pip.py to the attack surface.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: