4

I've installed python 2.7 in my system and I've installed Anaconda also. Right now, I am using python's anaconda and it works perfect. Unfortunately, I wanted to use anaconda's python to be run using root. The issue is that I was unable to change the python path for root.

If I type "which python" from terminal , I am able to get this result:

/home/myuser/anaconda/bin/python

If I type "sudo which python" from terminal, the result is :

/usr/bin/python

I have installed anaconda in a directory accessible by root (changed during installation) and I've already added it's path to /etc/environment(added /usr/anaconda/bin to PATH in environment).

How do I change the default python path of root(I use sudo command to get root privileges)?

I'm using ubuntu 12.04.

7
  • As any user also root has a .bashrc where you can set the PATH variable appropriately. Commented Feb 27, 2015 at 8:18
  • how about using a symlink? Commented Feb 27, 2015 at 8:20
  • @cel I've already added the PATH using /etc/environment file. I thought, it is enough. Do I have to add that path in .bashrc also? Commented Feb 27, 2015 at 8:22
  • @cel I'm sorry that I used the word root. Actually, I was using sudo to get root privileges. Commented Feb 27, 2015 at 8:28
  • 1
    Could be related: unix.stackexchange.com/questions/91541/… Commented Feb 27, 2015 at 12:45

1 Answer 1

2

You can explicitly call the python install you'd like to run:

sudo /opt/anaconda/bin/python

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

Sign up to request clarification or add additional context in comments.

1 Comment

That's why I was getting no module named asyncio. One up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.