dAnjou
dAnjou

Reputation: 3923

How do I let pip install into HOME by default?

I want that pip always installs into $HOME just as if I type

pip install --user ...

But I don't want to type --user all the time. I think setting an environment variable would be a good solution but I'm not sure and I didn't find anything.

Upvotes: 1

Views: 296

Answers (3)

mxcl
mxcl

Reputation: 26903

Based on other answers, here's a bash function to add to you .bash_profile:

function pip {
    if [ "$1" == "install" ] || [ "$1" == "bundle" ]; then
        /usr/local/bin/pip $1 --user ${@:2}
    else
        /usr/local/bin/pip $@
    fi
}

Upvotes: 0

dAnjou
dAnjou

Reputation: 3923

Here is my solution based on the idea of unutbu:

~/bin/ppip (p ersonal pip):

#!/bin/sh

if [ "$1" == "install" ] || [ "$1" == "bundle" ]
  then
    pip $1 --user ${@:2}
  else
    pip $@
fi

Improvements are welcome.

Upvotes: 2

unutbu
unutbu

Reputation: 880627

You could make a little script:

mypip:

#!/bin/sh
pip $@ --user

Upvotes: 1

Related Questions