linux – sudo: python: command not found
linux – sudo: python: command not found
Your /etc/sudoers
is explicitly configured to override your users path with a known, secure one.
That said, if you want to always path the users PATH through, you can easily override sudo
with a function that will do this (installed in your ~/.bashrc
or similar to make it persistent):
psudo() { sudo env PATH=$PATH [email protected]; }
thereafter, psudo python
will use the same python
interpreter that would be found in the PATH.
If you really want to override the sudo
command itself, thats doable too:
sudo() { command sudo env PATH=$PATH [email protected]; }
The command
builtin prevents the function from recursing (calling itself).
If you dont want to modify your bashrc, you can always do this:
sudo env PATH=$PATH python something
linux – sudo: python: command not found
…other approach.
when I got to this post, I was just looking to run:
python -m spylon_kernel install
as I ran the command above, I got a message telling me to use sudo
in addition to what I was typing, such as
sudo python -m spylon_kernel install
as I did it, I got the sudo: python: command not found message from console, and adding –user such as:
python -m spylon_kernel install --user
was simply enough to get it done.
Notice that I did not use
sudo
command within the last command.