首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从enthought mayavi导入mlab

从enthought mayavi导入mlab
EN

Stack Overflow用户
提问于 2013-06-12 20:47:49
回答 1查看 2.7K关注 0票数 1

我正在尝试从enthought mayavi模块导入mlab。我使用的是enthought发行版。

我得到了以下一系列错误。在搜索时,我似乎找不到任何类似的错误。

有谁对下一步有什么想法吗?

代码语言:javascript
复制
ImportError                               Traceback (most recent call last)
<ipython-input-11-3f0e4b94a8ea> in <module>()
----> 1 from mayavi import mlab

C:\...\Enthought\Canopy32\User\lib\site-packages\mayavi\mlab.py in <module>()
     25 
     26 # Mayavi imports
---> 27 from mayavi.tools.camera import view, roll, yaw, pitch, move
     28 from mayavi.tools.figure import figure, clf, gcf, savefig, \
     29     draw, sync_camera, close, screenshot

C:\...\Enthought\Canopy32\User\lib\site-packages\mayavi\tools\camera.py in <module>()
     23 # We can't use gcf, as it creates a circular import in camera management
     24 # routines.
---> 25 from engine_manager import get_engine
     26 
     27 

C:\...\Enthought\Canopy32\User\lib\site-packages\mayavi\tools\engine_manager.py in         <module>()
     12 from mayavi.preferences.api import preference_manager
     13 from mayavi.core.registry import registry
---> 14 from mayavi.core.engine import Engine
     15 from mayavi.core.off_screen_engine import OffScreenEngine
     16 from mayavi.core.null_engine import NullEngine

C:\...\Enthought\Canopy32\User\lib\site-packages\mayavi\core\engine.py in <module>()
     25 
     26 # Local imports.
---> 27 from mayavi.core.base import Base
     28 from mayavi.core.scene import Scene
     29 from mayavi.core.common import error, process_ui_events

C:\...\Enthought\Canopy32\User\lib\site-packages\mayavi\core\base.py in <module>()
     17     HasTraits, WeakRef, on_trait_change)
     18 from traitsui.api import TreeNodeObject
---> 19 from tvtk.pyface.tvtk_scene import TVTKScene
     20 from apptools.persistence import state_pickler
     21 from pyface.resource.api import resource_path

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\pyface\tvtk_scene.py in <module>()
     22      Property, Instance, Event, Range, Bool, Trait, Str
     23 
---> 24 from tvtk.pyface import light_manager
     25 
     26 VTK_VER = tvtk.Version().vtk_version

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\pyface\light_manager.py in <module>()
    128 # `CameraLight` class.
    129 ######################################################################
--> 130 class CameraLight(HasTraits):
    131 
    132     """This class manages a tvtk.Light object and a LightGlyph object."""

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\pyface\light_manager.py in CameraLight()
    144     activate = Trait(False, false,
    145                      desc="specifies if the light is enabled or not")
--> 146     source = Instance(tvtk.Light, ())
    147 
    148     # FIXME: Traits Delegation does not work correctly and changes to

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\tvtk_classes.zip\tvtk_classes\tvtk_helper.py in <lambda>(self)
    204     LabelHierarchyIterator = property(lambda self: get_class('LabelHierarchyIterator'))
    205     LabelRenderStrategy = property(lambda self: get_class('LabelRenderStrategy'))
--> 206     Light = property(lambda self: get_class('Light'))
    207     LightKit = property(lambda self: get_class('LightKit'))
    208     LineIntegralConvolution2D = property(lambda self: get_class('LineIntegralConvolution2D'))

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\tvtk_classes.zip\tvtk_classes\tvtk_helper.py in get_class(name)
     34     else:
     35         fname = camel2enthought(name)
---> 36         mod = get_module(fname)
     37         klass = getattr(mod, name)
     38         _cache[name] = klass

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\tvtk_classes.zip\tvtk_classes\tvtk_helper.py in get_module(fname)
     26         # inside the tvtk_classes ZIP file and are local to the
     27         # current module: tvtk_helper.py
---> 28         mod = __import__('tvtk.tvtk_classes.%s'%fname, globals(), locals(), [fname])
     29     return mod
     30 

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\tvtk_classes.zip\tvtk_classes\light.py in <module>()

C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\array_handler.py in <module>()
     27 
     28 # Enthought library imports.
---> 29 from tvtk.array_ext import set_id_type_array
     30 
     31 # Useful constants for VTK arrays.

ImportError: cannot import name set_id_type_array
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-18 15:59:46

看一下"array_handler.py“文件。在第29行

代码语言:javascript
复制
   29 from tvtk.array_ext import set_id_type_array

在"array_handler.py“正在运行的文件夹中没有名为" tvtk”的文件夹,因为我们已经在名为tvtk的文件夹中。因此,代码应该改为:

代码语言:javascript
复制
from array_ext import set_id_type_array

可以在您的计算机中找到"array_handler.py“

代码语言:javascript
复制
   C:\...\Enthought\Canopy32\User\lib\site-packages\tvtk\array_handler.py 

我也有同样的问题,这解决了它。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17065912

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档