[vtkusers] How to import vtk in python?

David Thompson david.thompson at kitware.com
Thu May 21 22:00:22 EDT 2015


Hi Lin,

> I tried to add lib and bin folder to the PYTHONPATA but it still failed to find the module. 

Looks like you may need to modify your PATH environment variable as well as PYTHONPATH. See here:

  http://stackoverflow.com/questions/214852/python-module-dlls

for how to do that on Windows.

> Running vtkPython directly leads python command line with correct vtk module but I'm not very clear about how to run the python test in this way.

You can run "ctest -N -V -R vtkFiltersBezierPython-PatchInterpolation" to see the command line for running the Python test. Note that ctest sets environment variables for the tests it runs but does not list them along with the command line. So running the test with ctest sometimes works when starting things from the command line does not.

> 
> PS. I found two executable files vtkWrapPython-6.3.exe and  vtkWrapPythonInit-6.3.exe. What's the use of them?

They are used to generate source code that makes VTK classes available in python and prepare a python interpreter.

	David


More information about the vtkusers mailing list