I am trying to install Python with VTK on my computer, but when I want to import VTK, I get an error:
import vtk
Traceback (most recent call last):
File
Assuming you used the suggested paths in the instructions, add the following line to your bashrc:
export PYTHONPATH=$HOME/projects/VTK-build/lib:$HOME/projects/VTK-build/Wrapping/Python:$PYTHONPATH
If the problem occurs when using sudo, e.g.
sudo yum install mayavi
you probably need to resolve this issue. Add the following line to the bashrc:
alias sudo=’sudo env PYTHONPATH=$PYTHONPATH’
Full instructions
You need to add the folder of vtkCommonPython.pyd also to the system path (like if it was a dll). See also http://www.vtk.org/Wiki/VTK/Tutorials/PythonEnvironmentSetup