I have python2 and python3 both installed on Ubuntu 16.04, and use python3 primarily. I have both pip
and python
aliased to pip3
and python3
, respectively, in my user's .bashrc
.
However, I had always gotten funky interactions with pip while installing new packages, and now I find out why: when I sudo pip install whatever
, the alias in .bashrc
is no longer applied to the superuser.
Supposing this computer isn't mine alone and other users might log in and want to use python2 primarily, how can I set it up so that for my user only can use sudo pip
to install python3 packages?