Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Running Sage inside Python

I was following a tutorial which I may not post because of low karma. 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!

Running Sage inside Python

I was following a tutorial which I may not post because of low karma. 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!

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.

#!/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!