简体   繁体   中英

compilation of vtk with python wrapper

I'm trying to build the VTK library with python wrappers. I want to develop a python program to post-process some CFD results in VTK format.

I'm compiling the source in a local folder.

Unfortunately I'm facing several issues: firstly during the compilation I get the following error message:

CMake Error at Common/Core/cmake_install.cmake:47 (file):
file INSTALL cannot find
"/home/riccardo/Software/VTK/build/lib/libvtkCommonCore-8.0.so.1".

I tried to disable the option of shared libraries as suggested here VTK install error cannot find libvtkCommonCore-6.3.so.1 in the cmake configuration

cmake ..\
  -DCMAKE_INSTALL_PREFIX=/home/riccardo/Software/VTK/build \
  -DBUILD_SHARED_LIBS:BOOL=OFF \
  -DCMAKE_BUILD_TYPE=Release \
  -DVTK_USE_SYSTEM_ZLIB:BOOL=ON

In this case the compilation went fine but when I tried to import vtk in python I get this error:

from .vtkCommonCore import *
 42 from .vtkCommonMath import *
 43 from .vtkCommonMisc import *

 ~/Software/VTK/build/Wrapping/Python/vtk/vtkCommonCore.py in <module>()
    7     # during build and testing, the modules will be elsewhere,
    8     # e.g. in lib directory or Release/Debug config directories
---->   9     from vtkCommonCorePython import *

    ImportError: No module named 'vtkCommonCorePython'   

I really don't know how to fix it. Any help would be more than welcome.

Many thanks in advance!!!

Have you tried to tell CMake the python version you want to wrap?

That is, add:

-D VTK_WRAP_PYTHON:BOOL=ON \
-D VTK_PYTHON_VERSION:STRING=3.5 # or your python version
-D PYTHON_EXECUTABLE:PATH=\usr\bin\python3 # or wherever your python exec is

In the CMake configuration and see what happens.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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