mayavi

安装mayavi遇到的一些问题

mayavi库相较于matplot能够更好的展现3D的视图,最近在学习python的时候要用到mayavi这个库,由于我本人用的是anaconda版本的python,默认python版本是3.8.8版本的,下了mayavi却一直报错,后来去查了查应该是python版本问题,于是搞了个3.7版本的虚拟环境,直接在anaconda下载mayavi仍然一直报错,后来尝试了直接在cmd上pip install等等方法都不可行,搞了一晚上还没搞清楚。

这个过程我也遇到了很多网上相似的问题,但是解决方案回答在互联网上好像很少,我把我的解决流程发上来,供各位参考。

后来干脆手动安装whl的包

安装地址:pythonlibs

下载内容:mayavi,PyQt4,traits,VTK

这里需要注意的是下载的包必须是匹配的。

避免失误的话,这里你可以参考我的下载的包。


 mayavi-4.7.3-cp37-cp37m-win_amd64.whl
 PyQt4-4.11.4-cp37-cp37m-win_amd64.whl
 traits-6.3.1-cp37-cp37m-win_amd64.whl
 VTK-9.0.3-cp37-cp37m-win_amd64.whl

安装mayavi并不难,关键是mayavi所依赖的环境复杂,前期我下载的时候是胡乱安装的,导致我运行程序的时候一直报错。

将下载的四个文件的文件夹通过3.7的虚拟环境打开,然后直接输入:

pip install mayavi-4.7.3-cp37-cp37m-win_amd64.whl
pip install PyQt4-4.11.4-cp37-cp37m-win_amd64.whl
pip install traits-6.3.1-cp37-cp37m-win_amd64.whl
pip install VTK-9.0.3-cp37-cp37m-win_amd64.whl

即可。

以上的解决方案在互联网上已经有了,下面是一些我遇到的问题。

报错AttributeError: type object ‘DialogCode’ has no attribute 'Accepted’解决方案

在命令端下载PyQt5以及PyQt5配套的tools库即可。

DoAiQ.png

然后将pyqt5_tools文件的地址添加到path变量里面即可。

VTK版本不匹配解决方案

WARNING: Imported VTK version (9.1) does not match the one used

to build the TVTK classes (9.0). This may cause problems.

Please rebuild TVTK.

解决办法:将现版本的VTK(9.1)uninstall,然后install 9.0版本的VTK

直接在命令端输入

pip uninstall VTK==9.1

待完成以后再输入

pip install VTK==9.0

检测mayavi.mlab是否正常运行

在ipython中输入:

from mayavi import mlab

如果不报错即成功解决问题

Mayavi 的参考手册,适合初学者和expert。 User guide: full table of contents An overview of Mayavi Introduction What is Mayavi2? Technical details Using Mayavi as an application, or a library? Scenes, data sources, and visualization modules: the pipeline model Loading data into Mayavi Installation Installing ready-made distributions Requirements for manual installs Doing it yourself: Python packages: Eggs Installing with easy_install Step-by-step instructions to install with eggs under Windows Under Mac OSX Snow Leopard The bleeding edge: Git Testing your installation Troubleshooting Using the Mayavi application Tutorial examples to learn Mayavi Parametric surfaces: a simple introduction to visualization Loading scalar data: the heart.vtk example Visualizing rich datasets: the fire_ug.vtu example Using Mayavi with scipy Exploring a vector field General layout of UI Visualizing data Modules Filters Interaction with the scene Mouse interaction Keyboard interaction From interactive usage to scripting The embedded Python interpreter Recording Mayavi actions to a script Command line arguments mlab: Python scripting for 3D plotting A demo 3D Plotting functions for numpy arrays 0D and 1D data 2D data 3D data Changing the looks of the visual objects created Adding color or size variations Changing the scale and position of objects Changing object properties interactively Figures, legends, camera and decorations Handling several figures Figure decorations Moving the camera Running mlab scripts Using mlab interactively Using together with Matplotlib’s pylab In scripts Animating the data Assembling pipelines with mlab Data sources Modules and filters Case studies of some visualizations Visualizing volumetric scalar data Visualizing a vector field Advanced use of Mayavi Organisation of Mayavi visualizations: the pipeline Anatomy of a Mayavi pipeline The link between different Mayavi entry points A pipeline example examined Data representation in Mayavi Introduction to TVTK datasets The flow of data Retrieving the data from Mayavi pipelines Dissection of the different TVTK datasets Inserting TVTK datasets in the Mayavi pipeline Objects populating the Mayavi pipeline Scene Source Filter ModuleManager: Colors and legends node Module Engine Base class: PipelineBase Class hierarchy Advanced Scripting with Mayavi Design Overview: Mayavi as a visualization framework Scripting the mayavi2 application Using the Mayavi envisage plugins Building applications using Mayavi Custom interactive dialogs Embedding a Mayavi scene in a Traits dialog A scene, with mlab embedded Making the visualization live Integrating in a WxPython application Integrating in a Qt application Tips and Tricks Off screen rendering Avoiding the rendering window Platform Summary Rendering using the virtual framebuffer Using VTK with Mesa for pure software rendering Extending Mayavi with customizations Customizing Mayavi2 Scripting Mayavi without using Envisage Computing in a thread Polling a file and auto-updating Mayavi Serving Mayavi on the network TCP server: the serve_tcp function UDP server: the serve_udp function Animating a visualization Animating a series of images Making movies from a stack of images Scripting from the command line Texture mapping actors Shifting data and plotting Using the UserDefined filter Sharing the same data between scenes Using mlab Using the core Mayavi API Changing the interaction with a scene Accelerating a Mayavi script Miscellaneous Citing Mayavi Getting help Tests for Mayavi Helping out Development quick start Improving the documentation Example gallery Mlab functions gallery Advanced mlab examples Interactive examples Advanced visualization examples Data interaction examples Misc examples MLab reference Plotting functions barchart contour3d contour_surf flow imshow mesh plot3d points3d quiver3d surf triangular_mesh Figure handling functions clf close draw figure gcf savefig screenshot sync_camera Figure decoration functions colorbar scalarbar vectorbar xlabel ylabel zlabel Camera handling functions move pitch roll view yaw Other functions animate axes get_engine orientation_axes outline set_engine show show_engine show_pipeline start_recording stop_recording text text3d title Mlab pipeline-control reference Sources Tools Data Modules and Filters Mayavi API reference Pipeline base objects Scene Source Filter ModuleManager Module PipelineBase Engine Main view and UI objects Scene UIs: DecoratedScene and MayaviScene SceneEditor MlabSceneModel EngineView and EngineRichView Known bugs and issues Changelog Mayavi 3.4.0 (Oct 15, 2010) Enhancements Fixes Mayavi 3.3.2 (May 25, 2010) Enhancements Fixes Mayavi 3.3.1 (Feb 24, 2010) Enhancements Fixes Mayavi 3.3.0 (July 15, 2009) Enhancements Fixes Mayavi 3.2.0 (March 23, 2009) Mayavi 3.1.0 Mayavi 3.0.3 Mayavi 3.0.1 and 3.0.2 Mayavi 3.0.0
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值