VS2012编译安装VTK-5.10.1_支持python

来源:互联网 发布:linux安装aircrack 编辑:程序博客网 时间:2024/06/01 09:31

1 源码下载

    到参考资料[1]下载vtk-5.10.1.zip和vtkdata-5.10.1.zip。

2 源码解压

    这里以D:盘为例进行说明。在D:盘中创建一个目录VTK,然后在其中创建4个目录:source,、build、data和install。将vtk-5.10.1.zip和vtkdata-5.10.1.zip分别解压到VTK/src目录和VTK/data目录中。

3 初步配置

    下载pythoncmake并分别完成安装。打开cmake,设定"Where is the source code"和“Where to build the binaries”如下图所示:


                                                                                                             图1

然后点击上图中的Configure按钮,弹出下面的窗体:


                                                               图2

    在上图中选择用于编译VTK的工具。由于本次用于编译VTK的是VS2012,因此选择"Visual Studio 11"。点击“Finish”按钮,则开始配置。


4 进一步配置

    完成第三步后,结果如下图所示。


                                                               图3

    勾选上图advance选项,并且在Search输入框中搜索出BUILD_EXAMPLES、BUILD_TESTING、BUILD_SHARED_LIBS、VTK_USE_GUISUPPORT和VTK_WRAP_PYTHON(关于python,见参考资料[3]),然后勾选上。并且分别指定CMAKE_INSTALL_PREFIX和VTK_DATA_ROOT为D:/VTK/install和D:/VTK/data。完成后再次点击“Configure”按钮继续配置。

这时将会提示错误,如下图:


                                                      图4

    搜索VTK_USE_TK(方法同图3),去掉勾选,继续“Configure”。这是提示错误如下图:


                                                     图5

    搜索PYTHON_INCLUDE_DIR,然后指定其路径为C:/Python25/include(实际值根据python的头文件路径进行修改)。然后继续“Configure“。此时,提示错误如下:

                                                    图6

    搜索PYTHON_LIBRARY,然后指定其值为:C:/Python25/libs/python25.lib(是一个库,而不是一个路径),如下图:


                                                      图7

    继续”Configure“,提示”Configuring done“则表示配置成功。然而还是有很多警告信息。

    搜索"PYTHON_EXECUTABLE",并且设定为“C:/Pyghon25”/python.exe(具体值根据python的实际安装路径来定),如下图所示:

 

                                                    图8

    继续“Configure”,将会提示如下:


                                                   图9

    这时候需要再次“Configure”。

    最后,搜素VTK_USE_MFC,并且勾选,继续“Configure”,等提示“Configuring done”后,点击“Generate”按钮,将产生VS2012的工程。

5 编译

    在D:/VTK/build目录中找到VTK.sln并且使用VS2012打开它。选中“All_BUILD”,右键单击,选择“生成”,如下图:


                         图10

    编译过程中出现的问题,见参考资料[4]。

6 安装

6.1 C++库和头文件安装    

    完成第5步的编译后,就可以进行安装。选中INSTALL,右键单击,选择“仅用于项目”,然后选择“仅生成INSTALL(B)”如下图:


                                                        图11

    完成后,在D:/VTK/install目录中将会安装好VTK的库和头文件。如下图:


                                                 图12

6.2 Python安装

    编译好后,进入目录E:\VTK\vtk-5.10.1\bin\Wrapping\Python(具体目录,根据实际编译的情况进行修改),必须进这个目录,否则在执行下面的命令式将会提示找不到vtk目录。
2、在CMD中执行下面命令:(前提是已经在Windows中安装了python)

python setup.py install BUILD_TYPE=Debug

    安装过程提示信息如下:

E:\VTK\vtk-5.10.1\bin\Wrapping\Python>python setup.py install BUILD_TYPE=Debugrunning installrunning buildrunning build_pyrunning install_libcreating C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\charts.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\chemistry.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\common.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\filtering.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\genericfiltering.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\geovis.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\graphics.py -> C:\Python25\Lib\site-packages\vtkcreating C:\Python25\Lib\site-packages\vtk\gtkcopying build\lib\vtk\gtk\GtkGLExtVTKRenderWindow.py -> C:\Python25\Lib\site-packages\vtk\gtkcopying build\lib\vtk\gtk\GtkGLExtVTKRenderWindowInteractor.py -> C:\Python25\Lib\site-packages\vtk\gtkcopying build\lib\vtk\gtk\GtkVTKRenderWindow.py -> C:\Python25\Lib\site-packages\vtk\gtkcopying build\lib\vtk\gtk\GtkVTKRenderWindowInteractor.py -> C:\Python25\Lib\site-packages\vtk\gtkcopying build\lib\vtk\gtk\__init__.py -> C:\Python25\Lib\site-packages\vtk\gtkcopying build\lib\vtk\hybrid.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\imaging.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\infovis.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\io.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\parallel.py -> C:\Python25\Lib\site-packages\vtkcreating C:\Python25\Lib\site-packages\vtk\qtcopying build\lib\vtk\qt\QVTKRenderWidget.py -> C:\Python25\Lib\site-packages\vtk\qtcopying build\lib\vtk\qt\QVTKRenderWindowInteractor.py -> C:\Python25\Lib\site-packages\vtk\qtcopying build\lib\vtk\qt\__init__.py -> C:\Python25\Lib\site-packages\vtk\qtcreating C:\Python25\Lib\site-packages\vtk\qt4copying build\lib\vtk\qt4\QVTKRenderWindowInteractor.py -> C:\Python25\Lib\site-packages\vtk\qt4copying build\lib\vtk\qt4\__init__.py -> C:\Python25\Lib\site-packages\vtk\qt4copying build\lib\vtk\qvtk.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\rendering.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\required.py -> C:\Python25\Lib\site-packages\vtkcreating C:\Python25\Lib\site-packages\vtk\testcopying build\lib\vtk\test\BlackBox.py -> C:\Python25\Lib\site-packages\vtk\testcopying build\lib\vtk\test\Testing.py -> C:\Python25\Lib\site-packages\vtk\testcopying build\lib\vtk\test\__init__.py -> C:\Python25\Lib\site-packages\vtk\testcopying build\lib\vtk\textanalysis.py -> C:\Python25\Lib\site-packages\vtkcreating C:\Python25\Lib\site-packages\vtk\tkcopying build\lib\vtk\tk\vtkLoadPythonTkWidgets.py -> C:\Python25\Lib\site-packages\vtk\tkcopying build\lib\vtk\tk\vtkTkImageViewerWidget.py -> C:\Python25\Lib\site-packages\vtk\tkcopying build\lib\vtk\tk\vtkTkPhotoImage.py -> C:\Python25\Lib\site-packages\vtk\tkcopying build\lib\vtk\tk\vtkTkRenderWidget.py -> C:\Python25\Lib\site-packages\vtk\tkcopying build\lib\vtk\tk\vtkTkRenderWindowInteractor.py -> C:\Python25\Lib\site-packages\vtk\tkcopying build\lib\vtk\tk\__init__.py -> C:\Python25\Lib\site-packages\vtk\tkcreating C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\colors.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\misc.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\numpy_support.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\vtkConstants.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\vtkImageExportToArray.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\vtkImageImportFromArray.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\vtkMethodParser.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\vtkVariant.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\util\__init__.py -> C:\Python25\Lib\site-packages\vtk\utilcopying build\lib\vtk\views.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\volumerendering.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\widgets.py -> C:\Python25\Lib\site-packages\vtkcreating C:\Python25\Lib\site-packages\vtk\wxcopying build\lib\vtk\wx\wxVTKRenderWindow.py -> C:\Python25\Lib\site-packages\vtk\wxcopying build\lib\vtk\wx\wxVTKRenderWindowInteractor.py -> C:\Python25\Lib\site-packages\vtk\wxcopying build\lib\vtk\wx\__init__.py -> C:\Python25\Lib\site-packages\vtk\wxcopying build\lib\vtk\__helper.py -> C:\Python25\Lib\site-packages\vtkcopying build\lib\vtk\__init__.py -> C:\Python25\Lib\site-packages\vtkbyte-compiling C:\Python25\Lib\site-packages\vtk\charts.py to charts.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\chemistry.py to chemistry.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\common.py to common.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\filtering.py to filtering.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\genericfiltering.py to genericfiltering.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\geovis.py to geovis.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\graphics.py to graphics.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\gtk\GtkGLExtVTKRenderWindow.py to GtkGLExtVTKRenderWindow.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\gtk\GtkGLExtVTKRenderWindowInteractor.py to GtkGLExtVTKRenderWindowInteractor.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\gtk\GtkVTKRenderWindow.py to GtkVTKRenderWindow.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\gtk\GtkVTKRenderWindowInteractor.py to GtkVTKRenderWindowInteractor.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\gtk\__init__.py to __init__.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\hybrid.py to hybrid.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\imaging.py to imaging.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\infovis.py to infovis.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\io.py to io.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\parallel.py to parallel.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\qt\QVTKRenderWidget.py to QVTKRenderWidget.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\qt\QVTKRenderWindowInteractor.py to QVTKRenderWindowInteractor.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\qt\__init__.py to __init__.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\qt4\QVTKRenderWindowInteractor.py to QVTKRenderWindowInteractor.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\qt4\__init__.py to __init__.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\qvtk.py to qvtk.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\rendering.py to rendering.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\required.py to required.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\test\BlackBox.py to BlackBox.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\test\Testing.py to Testing.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\test\__init__.py to __init__.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\textanalysis.py to textanalysis.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\tk\vtkLoadPythonTkWidgets.py to vtkLoadPythonTkWidgets.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\tk\vtkTkImageViewerWidget.py to vtkTkImageViewerWidget.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\tk\vtkTkPhotoImage.py to vtkTkPhotoImage.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\tk\vtkTkRenderWidget.py to vtkTkRenderWidget.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\tk\vtkTkRenderWindowInteractor.py to vtkTkRenderWindowInteractor.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\tk\__init__.py to __init__.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\colors.py to colors.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\misc.py to misc.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\numpy_support.py to numpy_support.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\vtkConstants.py to vtkConstants.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\vtkImageExportToArray.py to vtkImageExportToArray.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\vtkImageImportFromArray.py to vtkImageImportFromArray.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\vtkMethodParser.py to vtkMethodParser.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\vtkVariant.py to vtkVariant.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\util\__init__.py to __init__.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\views.py to views.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\volumerendering.py to volumerendering.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\widgets.py to widgets.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\wx\wxVTKRenderWindow.py to wxVTKRenderWindow.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\wx\wxVTKRenderWindowInteractor.py to wxVTKRenderWindowInteractor.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\wx\__init__.py to __init__.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\__helper.py to __helper.pycbyte-compiling C:\Python25\Lib\site-packages\vtk\__init__.py to __init__.pycrunning install_datacopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkCommonPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkFilteringPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkIOPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkGraphicsPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkGenericFilteringPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkImagingPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkRenderingPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkVolumeRenderingPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkHybridPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkWidgetsPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkParallelPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkChartsPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkGeovisPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkInfovisPython.pyd -> C:\Python25\Lib\site-packages\vtkcopying E:\VTK\vtk-5.10.1\bin\bin\Debug\vtkViewsPython.pyd -> C:\Python25\Lib\site-packages\vtkrunning install_egg_infoWriting C:\Python25\Lib\site-packages\VTK-5.10.1-py2.5.egg-info
    通过上述提示信息,我们可以了解其安装过程,其实就是将文件复制到指定目录的一个过程。

参考资料

[1]VTK官网

[2]cmake官网              

[3]VTK在VS2010中的安装(含python)和第一个例子

[4]VTK在VS2010下的安装方法

[5]VTK/Configure and Build

0 0
原创粉丝点击