I have seen this but my root's path has no access to pip
.
Here is my terminal output.
lxa@lxa-pc:~$ lxa@lxa-pc:~$ sudo -H pip -V [sudo] lxa 的密码: pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5) lxa@lxa-pc:~$ pip -V pip 9.0.1 from /home/lxa/.local/lib/python3.5/site-packages (python 3.5) root@lxa-pc:~$ echo $PATH /home/lxa/bin:/home/lxa/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin lxa@lxa-pc:~$ sudo su lxa@lxa-pc:/home/lxa# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games lxa@lxa-pc:/home/lxa#
Best Answer
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: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 commandsudo -H pip3 -V
returnspip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
in a default Ubuntu 16.04 installation.This command returns
/usr/bin/python3
in a default Ubuntu 16.04 installation.This command returns
/usr/bin/pip
in a default Ubuntu 16.04 installation. The commandwhich pip3
returns/usr/bin/pip3
in a default Ubuntu 16.04 installation.