Day048 — VTK in python
Here is the procedure I took to set up a python project using VTK.
Environment:
- Python v3.6.4
- PyCharm Community IDE v2018.1.4
- Windows 10 Home v1803
- Create a new project in PyCharm using Virtualenv, which comes with the IDE
2. Create Cylinder.py and copy code from the example “CylinderExample”
https://lorensen.github.io/VTKExamples/site/Python/GeometricObjects/CylinderExample/
3. Open the embedded terminal and type pip install vtk
to install the latest version of VTK.
4. After installing the package, the red line under import vtk
should disappear.
5. Run Cylinder.py
6. A window with a cylinder inside should pop up.
Be noted that
The VTK master branch is regularly tested with Python 2.7 and 3.4, and VTK 7 should work with 2.5, 2.6, 2.7, and 3.2+. Versions of VTK prior to 7.0 will only work with Python 2.
from https://www.vtk.org/Wiki/VTK/Python_Wrapping_FAQ
reference website:
To install specific version:
pip install vtk==8.1.0
To write a dependency document like npm install package --save
: