1 | initial version |

There are a couple of ways of doing this. You can write a pythonscript script and import the sage module. In order to use sage commands use the following line

```
from sage.all import *
```

In order to do this you need sage in you PYHTONPATH. You can make sure it does by starting your python script with

```
import sys
sys.path.append('path-to-sage')
```

A better alternative, which I use when I am trying to do what you are doing, is that I write the python script with 'from sage.all import *' on the first line and then use the python from sage to run it using the command

```
sage -python
```

This way you can use the python interpreter of sage.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.