问题
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.
回答1:
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)
回答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
来源:https://stackoverflow.com/questions/9460145/sudo-required-for-easy-install-pip-in-os-x-lion