python - 如何在 Spyder IPython 控制台中从 sympy 获得 Latex 风格的输出?

标签 python latex anaconda sympy spyder

我在 Spyder 中使用 sympy,并希望在 IPython 控制台中使用 Latex 输出进行符号计算。我已经通过 Anaconda 安装了 Spyder 并创建了一个单独的环境。起初我只能得到 ASCII pretty-print 输出,但在那个环境中安装 matplotlib 之后,我也可以获得更好的图形输出。

from sympy import init_printing
init_printing() 
integrate(x)

当我在 IPython 中执行上述代码时,我得到图形(图像)输出 x^2/2,但不是 latex 。这意味着 sympy 没有找到 Latex,并使用了下一个最好的东西,在我的例子中是 matplotlib,对吗?

我不确定如何继续获得 Latex 风格的输出,我可以通过 Anaconda 安装一些包来自动升级到 Latex 输出,还是我必须在我的操作系统上手动安装一些 Latex 发行版,比如 MiKTeX?

最佳答案

When I execute the above code in IPython, I get graphical (image) output x^2/2, but not latex. This means sympy did not find Latex, and used next best thing, which is matplotlib in my case, right ?

没错。

I’m not sure how to proceed to get Latex-style output, can I install some package trough Anaconda to automatically upgrade to Latex output, or I have to manually install some Latex distribution on my operating system like MiKTeX ?

Anaconda 中没有其他包(除了 matplotlib)可以为您提供 Latex 输出,这意味着(正如您猜对的那样)您需要安装 Miktex 才能获得它。

关于python - 如何在 Spyder IPython 控制台中从 sympy 获得 Latex 风格的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43915513/

相关文章:

python - 如何使用Python SDK在Azure上创建SQL Server?

javascript - 通过 RESTful API 使用 django 和 backbone 进行用户注册

python - Latex 在 matplotlib 中无法正确显示

latex - TikZ 编码 : How to create space between polygon and the nodes it surrounds?

latex - 如何在括号内使用 LaTeX 打印引用?

python - conda 是否从使用 pip install 安装的 pypi 更新包?

python - Conda 占用太多磁盘空间

python - IPython 中的 __class__ 实现是否相对于 Python 进行了修改?

python - conda命令会提示错误: "Bad Interpreter: No such file or directory"

python - 当只有一个函数需要时,嵌套函数是一种好方法吗?