Why does sudo -H pip -V differ from pip -V?
Solution 1:
pip 8.1.1 is the version of python-pip from the default Ubuntu 16.04 repositories. When installing a package with pip set the HOME environment variable to the home directory specified by the target user's password database entry by using the option -H
.
In the question you linked to two different versions of pip were installed. To find out why pip -V
returns a more up-to-date version of pip (pip 9.0.1) which is also installed, run the following commands:
sudo -H pip -V
This command returns pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
in a default Ubuntu 16.04 installation. The command sudo -H pip3 -V
returns pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
in a default Ubuntu 16.04 installation.
which python3
This command returns /usr/bin/python3
in a default Ubuntu 16.04 installation.
which pip
This command returns /usr/bin/pip
in a default Ubuntu 16.04 installation. The command which pip3
returns /usr/bin/pip3
in a default Ubuntu 16.04 installation.