1
我試圖使用Mayavi的渲染體積Mayavi的無法呈現3D體積
from mayavi import mlab
mlab.init_notebook()
x, y, z = np.ogrid[-10:10:20j, -10:10:20j, -10:10:20j]
s = np.sin(x*y*z)/(x*y*z)
mlab.pipeline.volume(mlab.pipeline.scalar_field(s))
在jupyter筆記本測試下面的例子中,我接收到的錯誤:
Notebook initialized with x3d backend.
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /Users/phan/anaconda/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
309 method = get_real_method(obj, self.print_method)
310 if method is not None:
--> 311 return method()
312 return None
313 else:
/Users/phan/anaconda/lib/python2.7/site-packages/mayavi/tools/notebook.pyc in _repr_html_(self)
58 return scene_to_png(scene)
59 elif _backend == 'x3d':
---> 60 return scene_to_x3d(scene)
61
62
/Users/phan/anaconda/lib/python2.7/site-packages/mayavi/tools/notebook.pyc in scene_to_x3d(scene)
91 else:
92 url_base = "http://www.x3dom.org/download"
---> 93 x3d_elem = _fix_x3d_header(ex.output_string)
94 html = '''
95 %s
/Users/phan/anaconda/lib/python2.7/site-packages/mayavi/tools/notebook.pyc in _fix_x3d_header(x3d)
70 rep += '>'
71
---> 72 x3d = x3d.replace(
73 '<X3D profile="Immersive" version="3.0">',
74 rep
AttributeError: 'NoneType' object has no attribute 'replace'
Out[39]: <mayavi.modules.volume.Volume at 0x132e605f0>
我安裝了Python 2.7, VTK 6.3,特徵4.6在anaconda。
我和OP有同樣的問題,它是特定於體繪製,其他繪圖類型的工作。 (至少對我來說這不是一個擴展問題) – slund
那是另一個問題。請打開一個專門的問題。 –