anacoda python3.4如何安装mayavi

anacoda python3.4如何安装mayavi

Steyp 1 依次安装文件包:

  1. qypt4
  2. VTK
  3. Rraits
  4. Mayavi

Step 2: 安装PySide

由于PySide与qypt4不兼容,因此需要安装:PySide-1.2.2-cp34-none-win_amd64.whl
下载地址:https://pypi.python.org/pypi/PySide/1.2.2#downloads

Step 3:将PySide加入环境变量

import os
os.environ['QT_API']='pyside'

Step 4:检测是否成功

# -*- coding: utf-8 -*-
from numpy import *
from mayavi import mlab

# Create the data.
dphi, dtheta = pi/20.0, pi/20.0
[phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7
x = r*sin(phi)*cos(theta)
y = r*cos(phi)
z = r*sin(phi)*sin(theta)

# View it.
s = mlab.mesh(x, y, z, representation="wireframe", line_width=1.0 )
mlab.show()

你可能感兴趣的:(python安装)