0

This question already has an answer here:

When I type the command

pip

it works fine (gives me a help page). But when I type the command

sudo pip

it gives me the response

sudo: pip: command not found

whereas for example 'sudo python' works fine. How is this situation possible? I am not very familiar with what is going 'behind the scenes' when I invoke a command with sudo

marked as duplicate by JRFerguson, Kiwy, Christopher, Andy Dalton, Kusalananda Jul 31 '18 at 21:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

There are some commands that can not be done as a normal user via sudo (ie. using cd to enter a root directory). This usually happens when the program is built-in to the shell and not a binary. You have to log in as a root user via su.

Alternatively, check your $PATH env variable, pip may not be located in any of those directories.

Not the answer you're looking for? Browse other questions tagged or ask your own question.