Ask Your Question

Revision history [back]

What you're trying to do is in no way supported and should not work. You can't import Sage into any "random python" on your system, even with the PATHs setup. For starters the version of Python differs from the one where Sage was built, which should cause trouble. But that is just the beginning. You can do this (use the Sage Python):

deep:sage wstein$ ./sage -python
Python 2.6.4 (r264:75706, Nov 10 2011, 11:56:29) 
>>> from sage.all import *
>>>

Also, Sage is likely to rely on modules not installed in your other Python. If there is any chance of what you're doing working by accident (and don't expect Sage to actually work well), this would be more likely to work:

$ sage -sh
$ /usr/bin/python
>>> import sys
>>> sys.path.append("/Users/wstein/Desktop/sage/local/lib/python/site-packages")
>>> import sage.all
...
ImportError: No module named _socket

If you have libraries in one copy of Python that you want to use with Sage, something you can try that might work is to start Sage's python and append to its sys.path the path of the other Python. I.e., do the exact opposite of what you're trying above.