ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 08 Nov 2016 19:38:49 +0100What does `from sage.all import *` do?https://ask.sagemath.org/question/35483/what-does-from-sageall-import-do/This question is relatd with another one: [What packages in sage can I use in python?](http://ask.sagemath.org/question/35464/what-packages-in-sage-can-i-use-in-python/)
[How do I import Sage into a Python script](http://doc.sagemath.org/html/en/faq/faq-usage.html#how-do-i-import-sage-into-a-python-script) told me that to use from `sage.all import *` to import sage packages in python. When I list the installed sage packages, there is igraph and python-igraph. But `from sage.all import *` will not import them into python. I'd like to know, what kind of packages can be imported when I use `from sage.all import *`.
BTW, the proper way to use `igraph` in python is `import igraph` with `python_igraph`installed.
ps: My karma is insufficient to publish links.edenharderTue, 08 Nov 2016 19:38:49 +0100https://ask.sagemath.org/question/35483/How to import 3rd party modules into SAGE?https://ask.sagemath.org/question/9754/how-to-import-3rd-party-modules-into-sage/In SAGE, I can import math or numpy from within a script, but I'm unable to import stuff located in, for example, /usr/lib/python2.7/dist-packages/. How could I fix that?
Thanks in advance.FaustoThu, 31 Jan 2013 07:38:17 +0100https://ask.sagemath.org/question/9754/import sage packages in pythonhttps://ask.sagemath.org/question/9302/import-sage-packages-in-python/An easy way to use sage in python files is demonstrated in the [Sage Tutorial](http://www.sagemath.org/doc/tutorial/programming.html).
#!/usr/bin/env sage -python
import sys
from sage.all import *
if len(sys.argv) != 2:
print "Usage: %s <n>"%sys.argv[0]
print "Outputs the prime factorization of n."
sys.exit(1)
print factor(sage_eval(sys.argv[1]))
Well, what if I don't want to import *all* of sage as shown above using:
from sage.all import *
Instead of this command above, I just want to import the following:
1. Matrix -> type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'
2. vector -> type 'sage.modules.vector_integer_dense.Vector_integer_dense'
3. ZZ -> type 'sage.rings.integer_ring.IntegerRing_class'
4. MixedIntegerLinearProgram -> type 'sage.numerical.mip.MixedIntegerLinearProgram'
So I should be able to write something like this in python
from sage.library.package.for.Matrix import *
from sage.library.package.for.vector import *
from sage.library.package.for.ZZ import *
from sage.library.package.for.MixedIntegerLinearProgram import *
I just don't know what they are. Any help is appreciated.
Thanks.MaelstromYamatoThu, 06 Sep 2012 13:29:57 +0200https://ask.sagemath.org/question/9302/