mayavi.mlab函数

时间:2017-10-20 22:04:06

标签: python python-2.7 conda mayavi

我刚刚开始一个图形讲座,想要玩python2.7,因为我们的讲座需要这个。

我们被要求安装https://conda.io/miniconda.html的miniconda发行版 然后使用conda

安装更多库

现在我有以下导入:

import math
import numpy  as np
import mayavi.mlab as mlab
import pickle

和这个功能:

def trimesh(F, V, new_figure=True):
    x = V[:,0]
    y = V[:,1]
    z = V[:,2]
    mlab.triangular_mesh(x, y, z, F)
    if new_figure:
        mlab.figure()

至于现在似乎行mlab.triangular_mesh()给了我一个问题。

我的PyCharm控制台出现以下错误:

Traceback (most recent call last):
  File "/Users/ronaldbrenner/PycharmProjects/untitled/transformation.py", line 50, in <module>
    trimesh(F, V)
  File "/Users/ronaldbrenner/PycharmProjects/untitled/transformation.py", line 26, in trimesh
    mlab.triangular_mesh(x, y, z, F)
  File "/Users/ronaldbrenner/miniconda2/lib/python2.7/site-packages/mayavi/tools/helper_functions.py", line 37, in the_function
    return pipeline(*args, **kwargs)
  File "/Users/ronaldbrenner/miniconda2/lib/python2.7/site-packages/mayavi/tools/helper_functions.py", line 77, in __call__
    scene = tools.gcf().scene
  File "/Users/ronaldbrenner/miniconda2/lib/python2.7/site-packages/mayavi/tools/figure.py", line 113, in gcf
    engine = get_engine()
  File "/Users/ronaldbrenner/miniconda2/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 101, in get_engine
    return self.new_engine()
  File "/Users/ronaldbrenner/miniconda2/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 146, in new_engine
    check_backend()
  File "/Users/ronaldbrenner/miniconda2/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 49, in check_backend
    ''')
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 <pkg_name>. 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


Process finished with exit code 1

我在macOS 10.13上使用python2.7 这是我的conda.info输出:

Current conda install:

               platform : osx-64
          conda version : 4.3.30
       conda is private : False
      conda-env version : 4.3.30
    conda-build version : not installed
         python version : 2.7.13.final.0
       requests version : 2.14.2
       root environment : /Users/ronaldbrenner/miniconda2  (writable)
    default environment : /Users/ronaldbrenner/miniconda2
       envs directories : /Users/ronaldbrenner/miniconda2/envs
                          /Users/ronaldbrenner/.conda/envs
          package cache : /Users/ronaldbrenner/miniconda2/pkgs
                          /Users/ronaldbrenner/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/main/osx-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/osx-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.30 requests/2.14.2 CPython/2.7.13 Darwin/17.0.0 OSX/10.13    
                UID:GID : 501:20

我希望有人可以帮助我,因为我对python不是很有经验。或者是否有人遇到过类似的问题?

先致谢谢,并致以诚挚的问候, 罗纳德

0 个答案:

没有答案