Running Matplotlib or enthought.mayavi.mlab from a py-shell inside Emacs on Windows
I can开发者_Go百科 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. What's going on here and how can I fix it?
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 file:
@python.exe -i D:\devel\Python27\Scripts\ipython-script.py console --matplotlib %*
I got it working with ipython.el.
I 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)
精彩评论