Ask Your Question

How do I get sage to honor my PYTHONPATH environmental variable?

asked 2011-02-28 10:54:52 -0500

bobby_mendoza gravatar image

I have a number of modules that I have in my documents folder but sage does not look like it honors my PYTHONPATH environmental variable. What do I have to add to my .bashrc or .bash_profile to have sage look at alternate paths?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2011-02-28 13:10:53 -0500

DSM gravatar image

updated 2011-02-28 14:21:45 -0500

Sage uses PYTHONPATH for its own purposes. If you add the directory/directories to SAGE_PATH (export SAGE_PATH=/some/dir/here) it should work, at least it seems to for me.

Beware: it looks like SAGE_PATH is added before Sage's existing python in sage-env:

PYTHONPATH="$SAGE_PATH:$SAGE_ROOT/local/lib/python"   && export PYTHONPATH

so if you shadow one of the built-in modules you could get strange errors. [Not that you couldn't get errors if it were the other way 'round, of course, but you might not even be able to get to the prompt.]

edit flag offensive delete link more


I'm also interested in this, but unfortunately I don't understand much of what is here written. Is it possible to explain this again for a computer newbie? (I'm trying to do this with ubuntu)

EmersonL gravatar imageEmersonL ( 2011-06-26 01:28:17 -0500 )edit

Emerson, these are directives specified in the .bashrc or .bash_profile file sitting in your home directory. The best thing for you to do is to learn about the .bashrc file (and the .bash_profile file) in general, then look into what are known as environment variables, which are these PATH things they are talking about.

tdstephens3 gravatar imagetdstephens3 ( 2011-06-27 04:35:48 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-02-28 10:54:52 -0500

Seen: 1,445 times

Last updated: Oct 05 '11