running matplotlib or enthought.mayavi.mlab from a py-shell inside emacs on windows

江枫思渺然 提交于 2019-12-07 22:32:38

问题


I can run the following code fine from a regular cmd shell:

import matplotlib.pyplot as plt
fig = plt.figure()
plt.show()
It launches a matplotlib window.
However, running inside emacs using shell or py-shell: the buffer just hangs and no window is launched. Anyone know what's going on here, or how to fix it ? Thanks.

回答1:


got it working with ipython.el. had to add modify python26\scripts\ipython.bat

@"c:\Python26\python.exe" "-i" "c:\Python26\scripts\ipython.py" "-wthread" %*
then in emacs:
(setq ipython-command "c:/python26/scripts/ipython.bat")
(require 'ipython)
(py-shell)



回答2:


Well after a tremendous amount of time and posting the bug on the matplotlib project page and the python-mode page I found out that supplying the arguments console --matplotlib in ipython.bat will do the trick with matplotlib 1.3.1 and ipython 1.2.0

This is what I have in my iphython.bat

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



来源:https://stackoverflow.com/questions/4701607/running-matplotlib-or-enthought-mayavi-mlab-from-a-py-shell-inside-emacs-on-wind

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!