I have a question about installing/upgrading Python packages using the tool pip.
I can either run
sudo pip install -U PACKAGENAME
or
pip install -U PACKAGENAME --user
What is the difference between those two commands and which one should I prefer...
- on my own machine?
- in the install script of a python program I publish?
pipviasudo: eithersudo -H pip install...orsudo -H python -m pip install...(note thatpiplikes to be called usingsudo -H). Thepipbundled withpythonis available as of Python 2.7.9 and later (on the python2 series), and Python 3.4 and later (for Python 3). – michael Sep 06 '16 at 09:02sudo pipdoes anything w/ system dependencies as well; e.g., does asudo pipon Ubuntu actually callapt-getto install (or remove!) anything? For instance, if I'm installingipythonviapip(putting it into/usr/localby default), but an older one was already installed viaapt-get(/usr/bin), does my system only work correctly if/usr/local/binis in my path ahead of/usr/bin? These issues seem to be resolved at run-time. Or, doessudo pipdo anything special at install time? – michael Sep 06 '16 at 09:07pipis completely unrelated toapt. One does not use the other and vice versa. – Byte Commander Sep 06 '16 at 11:05