enthought / enthought/mayavi

from mayavi import mlab not working

Open
#721 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

Hi,
I am new to Mayavi. I have just installed it and I want to run such code but it failed,can you tell me how to solve the problem?

> from scipy.integrate import odeint
> import numpy as np
> from mayavi import mlab
> def lorenz(w, t, a, b, c):
> # 给出位置矢量w,和三个参数a, b, c计算出
> # dx/dt, dy/dt, dz/dt的值
> x, y, z = w.tolist()
> # 直接与lorenz的计算公式对应
> return np.array([a * (y - x), x * (b - z) - y, x * y - c * z])
> t = np.arange(0, 30, 0.01) # 创建时间点
>
> track1 = odeint(lorenz, (0.0, 1.00, 0.0), t, args=(10.0, 28.0, 3.0))
> track2 = odeint(lorenz, (0.0, 1.01, 0.0), t, args=(10.0, 28.0, 3.0))
> #绘制图形
> mlab.plot3d(track1[:, 0], track1[:, 1], track1[:, 2], color=(1, 0, 0), tube_radius=0.1)
> mlab.plot3d(track2[:, 0], track2[:, 1], track2[:, 2], color=(0, 0, 1), tube_radius=0.1)

The error is as follows:

> ImportError: Could not import backend for traits
> _______________________________________________________________________________
> Make sure that you have either the TraitsBackendWx or the TraitsBackendQt
> projects installed. If you installed Mayavi with easy_install, try
> easy_install . easy_install Mayavi[app] will also work.
> If you performed a source checkout, be sure to run 'python setup.py install'
> in Traits, TraitsGUI, and the Traits backend of your choice.
> Also make sure that either wxPython or PyQT is installed.
> wxPython: http://www.wxpython.org/
> PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro

Thanks a lot!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.