# Running Sage inside Python

I was following a tutorial. I tried to run this code, but got sage is not recognized error. I am using Ubuntu (Mint). I added the sage root to my path. Now when I print $PATH in the terminal there is the sage path indeed. However, my script still does not recognize the Sage package. What may I be doing wrong? If any additional info is needed I will add it.

Here is the output of running $PATH:

bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/goran/Sage/sage-6.9-x86_64-Linux/sage

I am wondering what my header should look like (of the Python script). In the given example it is

```
#!/usr/bin/env sage.
```

I have been trying to adapt some other answers but none worked for me. What I want to achieve is calling Sage in Python code, because I have already written a couple of Python modules, and no I just need to call some Sage functions.

Thank you for the understanding!

I upvoted your question and you might be able to post the link. If it is so, you can update your question.

What happens if you just type "sage" from the command line? Do you get Sage starting?

I updated the question. When I run "sudo sage" I start Sage and can run commands. I tried basic arithmetic and it works fine.

Why do you need to do "sudo"? What about just "sage"?

What do you mean by "running $PATH"? It is a bash variable. There is no way to "run it".