I run with multiple Python versions and thus multiple pip versions as well.
Everytime, however, you update pip, you'll replace the standard pip
command with the version you updated. So even pip3 install --upgrade pip
will put a /usr/local/bin/pip
in your system, messing up the Python 2 version.
Instead, I run pip as an (executable) module:
python3 -m pip search <package>
or
python2 -m pip search <package>
or even
python3.5 -m pip search <package>
This guarantees that your pip
version always matches the Python version you want to use it for. It's somewhat longer to type, but I prefer the expliciteness of it (which, I guess, follows the Zen of Python).
Note that updating pip:
python3.5 -m pip install --upgrade pip
will still install a Python 3.5 version in /usr/local/bin/pip
, but I'm simply ignoring that. Just beware of (shell) scripts that execute pip
directly.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…