On Feb 5, 2008 1:50 PM, Alex Donaldson <[EMAIL PROTECTED]> wrote: > > I am using Mac OSX, running Python 2.5.1 from the terminal. > > By "regular interpreter" i mean, pulling up the Terminal and typing > python to launch the Python. I want to be able to bundle everything up > for users and let them interact with whatever interpreter they use and > not necessarily need to know about using sage. Allowing them to build > write scripts referencing my classes to manipulate data. > > Again, I'm new to Sage and Python (am typically a Java dev) so I > apologize if these questions are ridiculous. I am trying to find > analogous situation to jaring up my library and letting users use it > to build Java apps.
As a first step, here is a complete example on Mac OS X of using the Sage libraries with the stock system-wide Python 2.5.1 interpreter. Note the crucial use of "sage -sh", which sets a bunch of Sage-relevant environment variables. D-69-91-159-216:~ was$ sage -sh Starting subshell with Sage environment variables set. Be sure to exit when you are done and do not do anything with other copies of Sage! Sage subshell$ export PYTHONPATH=$SAGE_LOCAL/lib/python/site-packages Sage subshell$ python Python 2.5.1 (r251:54863, Feb 2 2008, 18:15:25) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sage.all >>> sage.all.factor(2008) 2^3 * 251 ------------------------ If you don't want to use Sage -sh you would have to set several SAGE environment variables. One way is by sourcing the script sage-env: D-69-91-159-216:~ was$ source SAGE_ROOT/local/bin/sage-env # replace SAGE_ROOT D-69-91-159-216:~ was$ export PYTHONPATH=$SAGE_LOCAL/lib/python/site-packages D-69-91-159-216:~ was$ python Python 2.5.1 (r251:54863, Feb 2 2008, 18:15:25) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sage.all >>> x = sage.all.x Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'x' >>> x = sage.all.var('x') >>> sage.all.sin(x**2).integrate() sqrt(pi)*((sqrt(2)*I + sqrt(2))*erf((sqrt(2)*I + sqrt(2))*x/2) + (sqrt(2)*I - sqrt(2))*erf((sqrt(2)*I - sqrt(2))*x/2))/8 --------------- I hope the above is of some use to you. William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---