简体   繁体   English

MayaVi:显示mlab段错误

[英]MayaVi: mlab segfaults on display

I am trying to learn MayaVi, but getting stuck on opening figures. 我正在努力学习MayaVi,但却陷入了打开数字的困境。

Displaying figures in mlab just results in a segfault. 在mlab中显示数字只会导致段错误。 It does not seem to matter what I plot, so I think that the problem is in the act of displaying, not in the object I am trying to display. 我绘制的内容似乎并不重要,所以我认为问题在于显示,而不是在我试图显示的对象中。 For example: 例如:

import numpy as np
from mayavi import mlab
x = y = np.arange(-5, 5, 1)
s = np.meshgrid(x, y)
mlab.surf(s)

results in the error: 导致错误:

Segmentation fault (core dumped)

I am using Python 2.7.3, EPD 7.3-1 (64-bit) on Linux. 我在Linux上使用Python 2.7.3,EPD 7.3-1(64位)。

EDIT: I actually get a different error if I try to display an image, which is one of my goals. 编辑:如果我尝试显示图像,我实际上会得到一个不同的错误,这是我的目标之一。

import numpy as np
from mayavi import mlab
from PIL import Image
img = Image.open('milkyway.png')
mlab.imshow(img)

results in 结果是

Fatal error in __driConfigOptions line 108393789, column 108392770: parsing finished.
Abort (core dumped)

EDIT2: Okay, it is definitely an issue in opening the figures, because if I just test: EDIT2:好的,打开数字肯定是一个问题,因为如果我只测试:

from mayavi import mlab
mlab.figure()

I get the initial error (a segfault). 我得到了初始错误(段错误)。

I'm not using Enthought but I got similar segfault errors and found help here: 我没有使用Enthought,但我遇到了类似的段错误,并在此处找到了帮助:

https://github.com/enthought/mayavi/issues/450 https://github.com/enthought/mayavi/issues/450

They say it is a compatibility problem between Qt4 (used by VTK) and Qt5 (used by Mayavi) and recommend switching to wx. 他们说这是Qt4(由VTK使用)和Qt5(由Mayavi使用)之间的兼容性问题,并建议切换到wx。 To do so, please run the following command in the terminal: 为此,请在终端中运行以下命令:

export ETS_TOOLKIT=wx

Then you should be able to run Enthough or your Python from the same terminal. 然后你应该能够从同一个终端运行Enthough或你的Python。

If that works, you might also consider adding the above line to your ~/.profile.d so that the export is automatically executed when starting the terminal. 如果可行,您可以考虑将上述行添加到〜/ .profile.d中,以便在启动终端时自动执行导出。 How this can automatically included in Enthought I don't know, sorry. 这怎么可以自动包含在Enthought我不知道,对不起。

I hope that helps, Mayavi is quite nice once it's up running! 我希望有所帮助,Mayavi一旦运行就会非常好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM