I get python 2.7 when running sudo. I've tried changing my .bash_profile and .bashrc from my original user and root, but to no avail.
$ python
Python 3.5.2 (default, Oct 11 2016, 05:05:28)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
$ sudo python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
I've alias python='python3'
in both bash configs in both users and sourced them.
How do I get python 3.5 to load with sudo python
?
EDIT: This is on OSX
EDIT2: I've also tried looking at which
python.
$ which python
/usr/bin/python
$ sudo which python
/usr/bin/python
As a possible workaround you can add to your bash_aliases (or similar to it):
alias python='/usr/bin/python3'
alias sudo='sudo '
And then:
. .bashrc
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