Gudin Gudin - 27 days ago 21
Linux Question

Root user has different python

I installed Anaconda with Python, added some more packages and tried to run Django development

python manage.py runserver 0.0.0.0
. It's running fine but I can't access it remotely from some reason. My server on other port is working fine and firewalls are all set. I found others had this problem and they simply run it as superuser
sudo python manage.py runserver 0.0.0.0
.

My problem is that when running as superuser, it will use different Python (or at least that's what it looks like). It is same 2.7.12 version (but no Anaconda suffix) and there are no required packages, so I can't run server.

I'm not really experienced with Linux. I tried to remove Python from root and passing env variables, but that didn't help. How can I run python as superuser and use Python with packages from my user.

Answer

Try sudo running your local python, like

sudo /home/YourAnaconda_bin/python manage.py runserver 0.0.0.0