Search code examples
pipsudo

sudo pip <something> doesn't work but pip <something> works


Just like the title says, when I try to:

sudo pip install virtualenvwrapper

I get an error:

sudo: pip: command not found

If I remove the sudo everything goes fine - why is that?


Solution

  • It seems like pip is not installed at system level.
    You can install pip at system level by running sudo apt-get install python-pip from terminal.
    After this you can upgrade pip by running sudo pip install --upgrade pip and sudo pip install virtualenvwrapper.

    Not wanting to use sudo for installing python packages and no need for global package installs you can use the --user flag like this :

    pip install --user <packagename>