繁体   English   中英

在python 3中使用mayavi的困难

[英]difficulty using mayavi in python 3

我在Windows上使用python 3.5,并遵循有关mayavi的教程(正在使用python 2.7),根据我以前的经验,版本不应该是一个大障碍,而事实证明它是一个大障碍。 这是一个简单的测试代码:

import numpy as np
from mayavi import mlab
t = np.linspace(0, 4 * np.pi, 50)
x = np.sin(2 * t)
y = np.cos(t)
z = np.cos(2 * t)
s = 1 + np.sin(t)
mlab.points3d(x, y, z, s)  

这就是我得到的(我的文件夹名称被删除)

Traceback (most recent call last):
  File "C:\...\PlotsPartOne.py", line 602, in <module>
    Main()
  File "C:\...\PlotsPartOne.py", line 590, in Main
    mayaviTest()
  File "C:\...\PlotsPartOne.py", line 582, in mayaviTest
    mlab.points3d(x, y, z, s)
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\helper_functions.py", line 37, in the_function
    return pipeline(*args, **kwargs)
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\helper_functions.py", line 77, in __call__
    scene = tools.gcf().scene
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\figure.py", line 113, in gcf
    engine = get_engine()
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\engine_manager.py", line 101, in get_engine
    return self.new_engine()
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\engine_manager.py", line 146, in new_engine
    check_backend()
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\engine_manager.py", line 49, in check_backend
    ''')
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 <pkg_name>. 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

而且我非常确定我已经安装了wxPython,traits和PyQt(版本5),但是不确定是否安装了TraitsBackendWx或TraitsBackendQt,我进行了搜索,但没有找到适用于python 3的任何软件包。有一个python 3版本,必须有一种方法可以在python 3上运行mayavi代码(我想...)。 那么,有什么办法可以解决这个问题?

TraitsBackendWx,TraitsBackendQt,Traits,TraitsGUI,Traits后端,wxPython或PyQT我都不缺少这些软件包,我需要的是PySide软件包...

pip install PySide-1.2.4-cp35-cp35m-win_amd64.whl

该软件包(由第三方警告)位于https://github.com/krrr/PySide/releases/download/1.2.4-1/PySide-1.2.4-cp35-cp35m-win_amd64.whl

我通过以下命令在ubuntu中工作:sudo apt-get install python3-pyside

其他相关模块为:vtk 8.1.0 mayavi 4.5.0 python 3.5.2

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM