6

I'm coming from Snow Leopard at work to a Lion installation at home. I do NOT remember having to:

sudo easy_install pip

Is that required for Lion? I got errors until I did that, and pip ended up here:

[ some@computer ] ~ $ which pip
/usr/local/bin//pip

Does this mean that I'm going to have to sudo pip install other packages? e.g.:

sudo pip install virtualenv
sudo pip install virtualenvwrapper

I should also note that I'm running XCode 4.3 with the new separate install of the command line tools. So I do NOT have a /Developer path right now on my OS X Lion volume.

juliomalegria
  • 24,229
  • 14
  • 73
  • 89

2 Answers2

5

Yes. Generally you sudo to use pip. You could change a bunch of permissions and you may not have to but that could break all sorts of things. If you want to avoid re-typing your password try opening a

"sudo screen" session first. Then your shell will be logged in as root and will not prompt for the password. (Using sudo screen will allow you to run pip and other admin commands without typing sudo again)

Chyper64
  • 113
  • 4
  • Our documentation at work for setting up virtualenv and virtualenvwrapper for Snow Leopard is horribly wrong / out of date, or I just never paid attention. Sudo'ing the hell out of easy_install pip and then the other system level pip installs (virtualenv and virtualenvwrapper) in Lion did work. Thx! – nthdegreeburns Mar 06 '12 at 15:50
  • sudo is fine but you shouldn't need sudo for virtualenv package installs. (assuming root doesnt own your virtualenv) – Chris Mar 27 '13 at 17:51
2

Actually since Python 2.6 there IS a command line switch that allows you to use pip without the need to sudo.

Try --user like this:

pip install --user <package_name>

You can also add --user to any update script that you may have like

pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install --user -U
gramio
  • 21
  • 2