Reputation: 577
I am having 2 python installation one for root user and one for normal user. I want to run a python program for root user with the python installation for normal user. how can it be done ?
python -c "import sys; print '\n'.join(sys.path)"
/home/ubuntu/anaconda2/lib/python27.zip
/home/ubuntu/anaconda2/lib/python2.7
/home/ubuntu/anaconda2/lib/python2.7/plat-linux2
/home/ubuntu/anaconda2/lib/python2.7/lib-tk
/home/ubuntu/anaconda2/lib/python2.7/lib-old
/home/ubuntu/anaconda2/lib/python2.7/lib-dynload
/home/ubuntu/anaconda2/lib/python2.7/site-packages
/home/ubuntu/anaconda2/lib/python2.7/site-packages/Sphinx-1.3.5-py2.7.egg
/home/ubuntu/anaconda2/lib/python2.7/site-packages/cryptography-1.0.2-py2.7-linux-x86_64.egg
/home/ubuntu/anaconda2/lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg
This is for the root user
sudo python -c "import sys; print '\n'.join(sys.path)"
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/dist-packages/rlp-0.4.6-py2.7.egg
/usr/local/lib/python2.7/dist-packages/devp2p-0.8.0-py2.7.egg
/usr/local/lib/python2.7/dist-packages/ethereum-1.6.0-py2.7.egg
/usr/local/lib/python2.7/dist-packages/ethereum_serpent-2.0.2-py2.7-linux-x86_64.egg
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
I want to run a python program using the anaconda python installation. but i dont want to change the path as there are other users using root python installation. In summary i want to run this program as root user with anaconda but without changing the default python installation path for root user.
Upvotes: 0
Views: 134
Reputation: 4068
Just specify the full path to the python installation you want to run.
sudo /home/ubuntu/anaconda2/bin/python -c "import sys; print '\n'.join(sys.path)"
Upvotes: 1