My problem is that when I do :
$ which python => I get /a/b/c/python as my directory
but if I do $ sudo which python => I get /d/e/python as the result
How do I change the sudo one to match with the normal case, it is making it impossible to install libraries from source.
According to https://askubuntu.com/questions/477987/two-python-distributions-sudo-picking-the-wrong-one this is a result of secure_path (specified in /etc/sudoers) overriding your normal PATH.
I've worked around it by giving the path to the path to the binary I want to run. For example:
$ which pip
/opt/local/bin/pip
$ sudo /opt/local/bin/pip install foo
It's not ideal but it works and doesn't subvert secure_path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With