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.Thu, 23 Apr 2015 11:32:28 +0200Interface between Sage and Pythonhttps://ask.sagemath.org/question/26626/interface-between-sage-and-python/ Hello,
I wonder if there is a way (or an API) that one can use Sage inside a Python code.
More specifically, I have a system of equations defined inside a big Python code, and I want to make Sage solve the equations and give the solutions back to Python.
Using the Python of Sage is out of option, unfortunately. Rather, I want to 'import' Sage onto Python and use its functionality as I import other Python libraries. Wed, 22 Apr 2015 22:33:08 +0200https://ask.sagemath.org/question/26626/interface-between-sage-and-python/Answer by tmonteil for <p>Hello,</p>
<p>I wonder if there is a way (or an API) that one can use Sage inside a Python code.</p>
<p>More specifically, I have a system of equations defined inside a big Python code, and I want to make Sage solve the equations and give the solutions back to Python.</p>
<p>Using the Python of Sage is out of option, unfortunately. Rather, I want to 'import' Sage onto Python and use its functionality as I import other Python libraries. </p>
https://ask.sagemath.org/question/26626/interface-between-sage-and-python/?answer=26629#post-id-26629To use Sage from a Python script, you indeed have to use Sage's Python, since various environment variables are set up (PATH, etc), see [this page](http://www.sagemath.org/doc/faq/faq-usage.html#how-do-i-import-sage-into-a-python-script).
Could you please explain why using the python of Sage is out of option ? What prevents you to follow the instructions above ? Perhaps this problem will be easier to solve.
Thu, 23 Apr 2015 11:32:28 +0200https://ask.sagemath.org/question/26626/interface-between-sage-and-python/?answer=26629#post-id-26629