2

I am trying to make a visualization of a graph using Sage. I need to make the visualization exactly as I am writing the Python code.

I have downloaded and installed the Sage for Ubuntu and Sage Notebook is working perfectly. But I want to take user input from Tkinter and then show those input on the Graph (generated by Sage). However, I am unable to import sage in the Python Shell. How can I do so?

4

1 回答 1

5

From looking at the faq, it looks like what you need to do is add the following line to your Python file:

from sage.all import *

Then, it looks like you need to run your script by using the Python interpreter bundled with Sage from the command line/console:

sage -python /path/to/my/script.py

However, if you want to use Sage directly from the shell, you should probably try using the interactive shell. (just type in sage or maybe sage -python from the command line)

Caveat: I haven't tested any of this myself, so you might need to do a bit of experimenting to get everything to work.

于 2013-03-30T23:03:16.797 回答