I know that sudo is a command used for administrators' tasks, such that installing or uninstalling a program.

What I don't understand from this command:

sudo pip3 install name-of-the-file.whl

is the pip3, which probably is an argument of sudo, but what is it useful for?

I am using Mac OSX 10.9.5.

  • pip3 is the python 3 package manager tool. probably it installs a python 3 package into the system wide python directory tree, so all users can access that package
    – deeenes
    Commented Oct 19, 2014 at 13:53
  • of course sudo is needed, otherwise those directories (e.g. /usr/lib/python/site-packages/) are not writeable
    – deeenes
    Commented Oct 19, 2014 at 13:55

1 Answer 1


The command sudo is a frontend program that takes arguments, switches and commands. Most commands can take arguments & switches, but some can take other commands to run. Think of them as wrappers if you will.

So sudo will create an entirely new instance of Bash (with elevated privileges as root), and then run the command you provided it.

So in this case sudo is running the program pip3 + all the arguments that occur after it. Those arguments, are for pip3, not for sudo. NOTE: keep in mind this template when you see sudo:

$ sudo <switches> "<command> <command's arguments + switches>"

So then what's pip3?

The commands themsevles are often a wealth of information when you're unsure what they do. Most will provide you a short synopsis of how to use them and what they do if you run them with a --help switch. This can vary, sometimes it's -help or even -h.

I don't have pip3 installed, but I do have pip2. They are in fact the same tool, but pip3 is a newer version.

$ pip2 --help

  pip <command> [options]

  install                     Install packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  search                      Search PyPI for packages.
  zip                         Zip individual packages.
  unzip                       Unzip individual packages.
  bundle                      Create pybundles.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output.
  --log <file>                Log file where a complete (maximum verbosity) record will be kept.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --cert <path>               Path to alternate CA bundle.

The --help shows us what this tool can take in terms of commands and switches, but doesn't tell us what it does. Let's see where it's located. For this you can use the type command:

$ type -a pip2
pip2 is /usr/bin/pip2
pip2 is /bin/pip2

Notice that it's in /usr/bin and /bin. So that would indicate that our package manager installed this tool. On a Red Hat based distro you could use rpm to find out what package this executable, pip2, belongs to.

$ rpm -qf /bin/pip2
file /bin/pip2 is not owned by any package

Interesting, so this executable isn't being managed as part of my system's package management tool, rpm.

So now what?

Well we're far from dead. Let's see if the system can give us any additional hints as to what installed pip2.

Most Linux distros ship with mlocate, a tool that periodically builds an index of all the files that are on the hard disk. So we can search for pip2 to get hints of other locations of places where pieces of it may be lurking.

$ locate pip2

So we know there's 2 versions installed, 2 and 2.7. But that didn't help a lot, so let's cast the net a bit wider and look for just pip. Also we're going to filter the results a bit and only get results that end with pip. We'll use grep to do this bit.

$ locate pip | grep 'pip$'


Finally! Some useful information. pip2 is a tool used by our installation of Python. So if we go to Google and look up "pip python":

Oh! pip2 is a package manager for Python.

So that command is installing a .whl file for our Python installation.


You must log in to answer this question.