无法导入mayavi:“导入错误:无法导入名称实现”

时间:2019-06-07 10:41:11

标签: python python-import importerror mayavi mayavi.mlab

我正在尝试在Python 2.7中使用Mayavi,但无法导入它。我的操作系统是Ubuntu(LTS)。这是代码:

import numpy
from mayavi.mlab import *

产生以下错误:

Traceback (most recent call last):
  File "/path/to/my/script/my_script_name.py", line 2, in <module>
    from mayavi import mlab
  File "/usr/local/lib/python2.7/dist-packages/mayavi/mlab.py", line 16, in <module>
    from mayavi.tools.camera import view, roll, yaw, pitch, move
  File "/usr/local/lib/python2.7/dist-packages/mayavi/tools/camera.py", line 24, in <module>
    from .engine_manager import get_engine
  File "/usr/local/lib/python2.7/dist-packages/mayavi/tools/engine_manager.py", line 12, in <module>
    from mayavi.preferences.api import preference_manager
  File "/usr/local/lib/python2.7/dist-packages/mayavi/preferences/api.py", line 4, in <module>
    from .preference_manager import preference_manager
  File "/usr/local/lib/python2.7/dist-packages/mayavi/preferences/preference_manager.py", line 30, in <module>
    from apptools.preferences.api import (ScopedPreferences, IPreferences,
  File "/usr/lib/python2.7/dist-packages/apptools/preferences/api.py", line 4, in <module>
    from preferences import Preferences
  File "/usr/lib/python2.7/dist-packages/apptools/preferences/preferences.py", line 9, in <module>
    from traits.api import Property, Str, Undefined, implements

ImportError: cannot import name implements

我尝试过强制重新安装mayavi,工具,特征包,但无济于事。我同时尝试了pip和apt。

编辑:我认为错误是mayavi无法访问我的Python 2.7安装的VTK。当我尝试强制重新安装mayavi时,出现错误“找不到满足vtk要求的下载(来自mayavi)”。该错误描述为here。我不知道该怎么办,因为vtk和vtkpython都已正确安装(使用apt)并可以正常工作-问题在于mayavi和pip不知道该怎么办?

0 个答案:

没有答案