I have installed python 2.7.8 via make
and make install
and then pip via get-pip. I have to note that I work behind a proxy which I have set up via
http_proxy
ftp_proxy
https_proxy
in
- my user's
~/.zshrc
- root's
/root/.basrc
now I am able to run pip
- on my user account
- on root account
but I am not able to run it via my user's shell using sudo
sudo pip
sudo: pip: command not found
What is wrong here?
1 Answer 1
That'll be because the PATH
is different when running with sudo
. Try comparing:
which pip
env
vs.
sudo which pip
sudo env
One secure workaround is to create a symbolic link to pip
in /usr/local/bin
or even /usr/bin
. If you install pip
using a package manager it will do this automatically on several (most?) distros.
-
6thanks,
alias sudo='sudo env PATH=$PATH'
solved the issue.Patryk– Patryk2014年11月21日 15:36:56 +00:00Commented Nov 21, 2014 at 15:36 -
There are security issues with that - you don't want to blindly set this in all your environments!l0b0– l0b02014年11月21日 15:39:18 +00:00Commented Nov 21, 2014 at 15:39
-
7I'm not sure if it was super clear in this answer, but the solution is indeed a
ln -s /usr/local/bin/<stuff> /usr/bin/<stuff>
JulienD– JulienD2015年08月19日 08:35:50 +00:00Commented Aug 19, 2015 at 8:35