After installing Mayavi from Christoph Gohlke's Python builds for Windows site , the following works from a plain interactive Python prompt:
import mayavi.mlab as MM
MM.test_surf()
But when I ran the same under jupyter-qtconsole
, the window comes up and hangs.
For reference, I have the following packages, installed in the order given, from the above website, over a fresh Python 2.7.13 install.
(These are just the dependencies to get a working environment with Jupyter, SciPy, matplotlib, Mayavi and just a couple of useful extras.)
I found a solution in this thread . This works from within Jupyter QTconsole:
import mayavi.mlab as MM
%gui qt
MM.test_surf()
Note that the %gui qt
command has to be issued after importing Mayavi.
(The explanation is that it "initialises Qt event loop support", not that this makes much sense to me.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.