Skip to main content
 首页 » 编程设计

python之在 Windows 上的 Emacs 中从 py-shell 运行 Matplotlib 或 enthought.mayavi.mlab

2025年05月04日6freeliver54

我可以在常规 cmd shell 中正常运行以下代码:

import matplotlib.pyplot as plt 
fig = plt.figure() 
plt.show() 

它启动一个 Matplotlib 窗口。 然而,使用 shell 或 py-shell 在 Emacs 中运行:缓冲区只是挂起,没有窗口启动。这是怎么回事,我该如何解决?

请您参考如下方法:

经过大量时间并在 matplotlib 项目页面和 python 模式页面上发布错误后,我发现在 ipython.bat 中提供参数 console --matplotlib 可以解决问题使用 Matplotlib 1.3.1 和 IPython 1.2.0。

这是我的 iphython.bat 文件中的内容:

@python.exe -i D:\devel\Python27\Scripts\ipython-script.py console --matplotlib %*