Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is normal. the sage executable is a shell script which defines some environment variables (among them SAGE_ROOT) then launches Sage's version of Python with the necessary libraries.

Similarly, sage -sh lauvhes the same shell script, whose argument sh launches a subshell where SAGE_ROOT is defined (among others, most notably the path).

The Python session implementing the Sage REPL doesn't need a SAGE_ROOT identifier, but it is defined in the underlying environment :

charpent@zen-book-flip:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.8.beta1, Release Date: 2022-09-29               │
│ Using Python 3.10.7. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: !echo $SAGE_ROOT
/usr/local/sage-9
sage: quit
charpent@zen-book-flip:~$ echo $SAGE_ROOT

HTH,