无法导入名称 mlab



我在尝试导入mayavi时遇到了一个非常奇怪的错误。几分钟前它就像一个魅力,但现在出了点问题,我不知道为什么。

我从终端开始python,然后键入:

from mayavi import mlab

我得到的错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/mayavi/mlab.py", line 27, in <module>
    from mayavi.tools.camera import view, roll, yaw, pitch, move
  File "/usr/lib/python2.7/dist-packages/mayavi/tools/camera.py", line 23, in <module>
    from engine_manager import get_engine
  File "/usr/lib/python2.7/dist-packages/mayavi/tools/engine_manager.py", line 14, in <module>
    from mayavi.core.engine import Engine
  File "/usr/lib/python2.7/dist-packages/mayavi/core/engine.py", line 28, in <module>
    from mayavi.core.scene import Scene
  File "/usr/lib/python2.7/dist-packages/mayavi/core/scene.py", line 15, in <module>
    from mayavi.core.source import Source
  File "/usr/lib/python2.7/dist-packages/mayavi/core/source.py", line 19, in <module>
    from mayavi.core.module_manager import ModuleManager
  File "/usr/lib/python2.7/dist-packages/mayavi/core/module_manager.py", line 19, in <module>
    from mayavi.core.lut_manager import LUTManager
  File "/usr/lib/python2.7/dist-packages/mayavi/core/lut_manager.py", line 10, in <module>
    import subprocess
  File "/usr/lib/python2.7/subprocess.py", line 432, in <module>
    import pickle
  File "pickle.py", line 4, in <module>
    from mayavi import mlab
ImportError: cannot import name mlab

Python有什么问题?

你有一个名为 pickle.py 的本地文件; 正在导入该文件而不是pickle模块。然后,此模块尝试在该模块本身完成循环导入依赖项中的导入之前导入mlab

  File "/usr/lib/python2.7/subprocess.py", line 432, in <module>
    import pickle
  File "pickle.py", line 4, in <module>
    from mayavi import mlab

请注意subprocess如何尝试导入pickle并找到您的文件(路径是相对的,而不是 /usr/lib/python2.7/ 中的完整路径。

pickle.py重命名为其他名称,您将在此处屏蔽标准库。

相关内容

  • 没有找到相关文章

最新更新