Installing mayavi under Windows 10 + Python 2.7

1. Error demonstration

First use mayavi configuration in Winpython The method in is installed, but the following error occurs when importing mayavi.mlab as mlab:

>> import mayavi.mlab as mlab
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\mayavi\", line 27, in <module>
    from import view, roll, yaw, pitch, move
  File "C:\Python27\lib\site-packages\mayavi\tools\", line 25, in <module>
    from engine_manager import get_engine
  File "C:\Python27\lib\site-packages\mayavi\tools\", line 14, in <module>
    from mayavi.core.engine import Engine
  File "C:\Python27\lib\site-packages\mayavi\core\", line 12, in <module>
    import vtk
  File "C:\Python27\lib\site-packages\vtk\", line 72, in <module>
    __helper.refine_import_err('rendering', 'vtkRenderingPython', exc)
  File "C:\Python27\lib\site-packages\vtk\", line 32, in refine_import_err
    raise LinkError, str(exc)
vtk.__helper.LinkError: DLL load failed: The specified module could not be found.

This is mainly the issue of version. It will be solved by changing the version.

2. Correct demonstration

Still in Unofficial Windows Binaries for Python Extension Packages Download the required wheel. The files to be downloaded this time are:

  1. traits‑4.6.0‑cp27‑cp27m‑win_amd64.whl
  2. VTK‑7.1.1‑cp27‑cp27m‑win_amd64.whl
  3. PySide‑1.2.4‑cp27‑cp27m‑win_amd64.whl
  4. mayavi‑4.5.0+vtk71‑cp27‑cp27m‑win_amd64.whl

Then install it in the terminal with the following command:

pip install traits‑4.6.0‑cp27‑cp27m‑win_amd64.whl
pip install VTK‑7.1.1‑cp27‑cp27m‑win_amd64.whl
pip install PySide‑1.2.4‑cp27‑cp27m‑win_amd64.whl
pip install mayavi‑4.5.0+vtk71‑cp27‑cp27m‑win_amd64.whl

And then there's usually no problem.
You can test it, create a new file, and enter:

import numpy as np
from mayavi import mlab


You can see the following picture when running.

Tags: pip Windows Python

Posted on Sat, 09 Nov 2019 16:06:47 -0500 by CJLeah