Hi Abhishek,

On 2018-09-29, Abhishek Kesarwani <1907a...@gmail.com> wrote:
>
> No, I am getting this error:
>
>>>> sage --python
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> NameError: name 'sage' is not defined

"sage --python" is the command that you should use on the command line
to *start* python (i.e., it is not a command to be used *in* python).

If the reason hasn't yet been explained to you in this thread: Sage has
its own installation of Python, that is totally separate from your
system-wide installation of Python. Hence, your system-wide installation
of Python simply doesn't know that sage exists.

Therefore, you should use Sage's python installation (that you can start
with the command
     sage --python
) and there you should be able to use Sage. Example:

    $ ./sage --python
    Python 2.7.15 (default, Aug  5 2018, 14:15:34) 
    [GCC 5.4.0 20160609] on linux2
    Type "help", "copyright", "credits" or "license" for more
    information.
    >>> from sage.all import ZZ
    >>> type(5), type(ZZ(5))
    (<type 'int'>, <type 'sage.rings.integer.Integer'>)

Note that the line "from sage.all import ZZ" takes a very long time, and
to my surprise directly doing "from sage.rings.integer_ring import Z as
ZZ" doesn't work.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to