I installed Anaconda in a Google Cloud Compute environment and can use it successfully from the shell as a normal user:
curt@lamp-v5mi:~$ python
Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar 9 2015, 16:20:48)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
However, when I start an interpreter via sudo python
, anaconda is not the interpreter used, and I would like it to be.
curt@lamp-v5mi:~$ sudo python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Confusingly, when I start a shell as root and then start an interpreter, anaconda is the interpreter used.
curt@lamp-v5mi:~$ sudo -s
root@lamp-v5mi:/home/curt# python
Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar 9 2015, 16:20:48)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
I have export PATH="/anaconda/bin:$PATH"
in both the root's and my normal account's .bashrc
files. At first I thought the issue was sudo python
not actually starting a root shell, and thus the export PATH="/anaconda/bin:$PATH"
not actually being done. But when from my normal account I do sudo echo $PATH
, it shows anaconda in there:
curt@lamp-v5mi:~$ sudo echo $PATH
/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
The anaconda installation was installed as root in /anaconda
and I did a chmod -R 770 /anaconda
to make it accessible to normal users, but I don't think this problem has anything to do with that.
How can I get anaconda to be the default interpreter when run from a sudo
command line?