Ubuntu下 python3 安装Mayavi

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zxgdll/article/details/78727916

ubuntu下python2.7 安装mayavi

安装简便:

sudo apt-get install python-dev
sudo apt-get install python-vtk
sudo pip install mayavi

ubuntu下python3 安装mayavi

如果使用sudo pip3 install mayavi
会提示vtk不存在的错误,尝试sudo apt-get install vtk
安装可以成功,但是再执行sudo pip3 install mayavi 会报错installing Mayavi with pip - no module named ‘vtkOpenGLKitPython’
所以这种方式不可用。
因此,尝试直接通过源码进行编译的方式,成功安装使用。
编译过程参考:
http://blog.csdn.net/ouening/article/details/76038702
按照如上方式,可以成功安装mayavi,但是在使用时出现如下错误:
“`ImportError: Could not import backend for traits
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.
``
这是因为我电脑里qt5与mayavi不兼容产生,
接下来通过:
sudo apt-get install python3-pyside`
安装pyside后,再执行测试代码,发现问题解决。

猜你喜欢

转载自blog.csdn.net/zxgdll/article/details/78727916