问题
OS: Linux Kubuntu 14.4.5
Python: Python 3.5.2 :: Continuum Analytics, Inc.
I tried to install Mayavi into my anaconda environment:
conda install -c menpo mayavi=4.5.0
conda install -c anaconda wxpython=3.0.0.0
conda install pyqt
conda install qt
But when I try to run the example from http://docs.enthought.com/mayavi/mayavi/auto/example_surface_from_irregular_data.html I get the error message
ImportError: Could not import backend for traits
with the explanation:
Make sure that you have either the TraitsBackendWx or the TraitsBackendQt projects installed. If you installed Mayavi with easy_install, try easy_install . easy_install Mayavi[app] will also work.
If you performed a source checkout, be sure to run 'python setup.py install' in Traits, TraitsGUI, and the Traits backend of your choice.
Also make sure that either wxPython or PyQT is installed. wxPython: http://www.wxpython.org/ PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro
I searched the web and tried to find anything to setup, but couldn't find anything.
From http://docs.enthought.com/mayavi/mayavi/installation.html?highlight=installation I got that I could install it via pip with pip install mayavi
, but that resulted only in the messages that "Requirement already satisfied", among which is
Requirement already satisfied: traits in /anaconda2/envs/myenv/lib/python3.5/site-packages (from mayavi)
What to do?
回答1:
The following steps worked for me (in a python2 environment):
conda create -yn mayavitest
source activate mayavitest
conda install -yc menpo mayavi=4.5.0
conda install -y pyside
conda install qt
ETS_TOOLKIT=qt4 python /path/to/mayavi-example.py
The installation of pyside might downgrade qt, that is why qt needs to be installed again.
回答2:
Maybe OpenGL or any graphic card driver is missing. Because same error i got couple days ago was in windows server 2012 in hyper-v.
In windows you would used christopher gholke's windows wheels. In windows, again, you would need VC 2015 14.0 to compile traits libs. Maybe you need to dig what you need to install to compile traits libs.
来源:https://stackoverflow.com/questions/41960672/how-to-install-mayavi-trait-backends