Instruction on how to use Sage with Eclipse and PyDev

1,055 views
Skip to first unread message

Nicolas Essis-Breton

unread,
Dec 16, 2011, 9:22:25 PM12/16/11
to sage-support
I'm just beginning to use this setup. Maybe, there are are some hidden
limitations.

I assume you have a working installation of eclipse, PyDev and Sage.

Do this in eclipse:
1- set PyDev python interpreter to Sage
windows: preferences: PyDev: Interpreter Python: new: /sage/local/bin/
python2.6
accept all the dependencies

2- add support for '.sage' file
windows: preferences: general: content type: python file: add
'.sage'
windows: preferences: general: file association: add '.sage' with
'Python editor'
windows: preferences: pydev: code style: file types: add 'sage' in
valid source file,
and set 'sage' as default python extension

3- configure interactive console with appropriate startup command
windows: preferences: pydev: interactive console: initial interpreter
commands :
import sys; from sage.all import *;
preparser(on=True);execfile=load;
(we activate the preparser and overwrite PyDev 'execFile' with
Sage 'load')

To run Sage in Eclipse, I do in a terminal:
$sage -sh
$eclipse

How I use it:
-In top of each sage script, I need to write
import sys
from sage.all import *

-I run a script by passing it directly to the interactive console.
When a script as the focus in the text editor, the shortcut is 'Ctrl
+Alt+Enter'.

-I didn't yet find a way to properly configure the debugger and 'Run
As' for .sage files. But, I think every functionality of sage is
there.

-I use Sage 4.7.2, Eclipse indigo, PyDev 2.3

Ahmed Zawia

unread,
Sep 20, 2016, 1:08:03 PM9/20/16
to sage-support
hi, I am trying to install module sage.all but i could not !!
can you please assist me
thanks
Reply all
Reply to author
Forward
0 new messages