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.
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)
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