How to run Sage in a systemwide Python

Create the run_sage bash script:

export SAGE_ROOT=/home/ondra/ext/sage

export SAGE_LOCAL=$SAGE_ROOT/local
export DOT_SAGE=~/.sage/
export PATH=$SAGE_ROOT/local/bin:$PATH

export LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/openmpi:$SAGE_ROOT/local/lib/:"

export PYTHONPATH="$SAGE_ROOT/local/bin:$SAGE_ROOT/local/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg:$SAGE_ROOT/local/lib/python2.5/site-packages/SQLAlchemy-0.4.3-py2.5.egg:$SAGE_ROOT/local/bin:$SAGE_ROOT/local/lib/python:$SAGE_ROOT/local/lib/python25.zip:$SAGE_ROOT/local/lib/python2.5/plat-linux2:$SAGE_ROOT/local/lib/python2.5/lib-tk:$SAGE_ROOT/local/lib/python2.5/lib-dynload:$SAGE_ROOT/local/lib/python2.5/site-packages:$SAGE_ROOT/local/lib/python2.5/site-packages/IPython/Extensions"

ipython

Then:

$ ./run_sage 
Python 2.5.1 (r251:54863, Mar 29 2008, 09:29:46) 
Type "copyright", "credits" or "license" for more information.

IPython 0.8.1 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from sage.all import *
Falling back to a hard coded sage server in misc/hg.py

In [2]: var("x")                                                               
Out[2]: x

In [3]: x**2/4 + log(x)                                                        
Out[3]: log(x) + x^2/4