Building VTK with Python3 Wrappers
In my previous post I tried to give a short guide on how to build VTK with python wrappers. But then I tried to build it for python3 and found that my own guide does not work :P . So here is an updated version of the guide. I am using Arch Linux. But this should work for most linux distros.
Fetch the source code of VTK
We have two options here
- Download the latest release from VTK Website
- Clone the git repository from gitlab
We will clone the source from GitLab here
This will create a directory named vtk
Build VTK
We will build the source from a different folder.
Now configure cmake properly. This is the most important part.
We will see a screen like this:
Now press c to configure. After configuring several options should appear.
Press t to toggle to Advanced mode.
Now change the following:
Toggle BUILD_TESTING on.
Toggle VTK_WRAP_PYTHON on.
Toggle VTK_WRAP_TCL on.
Change CMAKE_INSTALL_PREFIX to /usr
Change VTK_PYTHON_VERSION to 3.5 (your python version)
Change PYTHON_EXECUTABLE to your python executable. For me it was /usr/local/bin/python . You can check it by typing which python
in your terminal.
Change PYTHON_INCLUDE_DIR to the directory where the python libraries are installed. In my case it is /usr/lib/python3.5/
Configure and Build
Press c to configure. Now press g to generate Makefile.
( You may have to press c and g again as it sometimes does not work properly )
Then install VTK and the Wrappers
And that should be it :)
Check your vtk installation: Open python and run
If that did not raise any error then you should be good to go!
Please leave a comment if you have any issues.
References: http://www.math.univ-paris13.fr/~cuvelier/mainsu35.html
Posted with Tags: