Getting "Permission Denied" when running pip as root on my Mac
Use a virtual environment:
$ virtualenv myenv
.. some output ..
$ source myenv/bin/activate
(myenv) $ pip install what-i-want
You only use sudo
or elevated permissions when you want to install stuff for the global, system-wide Python installation.
It is best to use a virtual environment which isolates packages for you. That way you can play around without polluting the global python install.
As a bonus, virtualenv does not need elevated permissions.
Is it acceptable & safe to run
pip install
undersudo
?
It's not safe and it's being frowned upon – see What are the risks of running 'sudo pip'?
To install Python package in your home directory you don't need root privileges. See description of --user
option to pip.