将默认python更改为root中的anaconda&#python

时间:2015-02-27 08:13:22

标签: python ubuntu path sudo anaconda

我在我的系统中安装了python 2.7,我也安装了Anaconda。 现在,我正在使用python的anaconda,它完美无缺。不幸的是,我想使用anaconda的python来运行root。问题是我无法更改root的python路径。

如果我从终端输入“which python”,我就能得到这个结果:

/home/myuser/anaconda/bin/python

如果我从终端输入“sudo which python”,结果为:

/usr/bin/python

我已经在root访问的目录中安装了anaconda(在安装期间更改),我已经添加了它的路径/etc/environment(在环境中将/usr/anaconda/bin添加到PATH)。

如何更改root的默认python路径(我使用sudo命令获取root权限?)

我正在使用ubuntu 12.04。

1 个答案:

答案 0 :(得分:1)

您可以显式调用您想要运行的python安装:

sudo /opt/anaconda/bin/python

请参阅https://askubuntu.com/questions/477987/two-python-distributions-sudo-picking-the-wrong-one