VTK/Tutorials/PythonEnvironmentSetup: Difference between revisions

From KitwarePublic
< VTK‎ | Tutorials
Jump to navigationJump to search
(added some spaces which make the commands stand out)
Line 2: Line 2:


To run a vtk python script, simply type:
To run a vtk python script, simply type:
python script.py
python script.py


If you receive this error:
If you receive this error:
ImportError: No module named vtk
ImportError: No module named vtk


add the following line to ~/.bashrc
add the following line to ~/.bashrc
export PYTHONPATH=$PYTHONPATH:/home/doriad/bin/ParaView3/VTK/Wrapping/Python/:/home/doriad/bin/ParaView3/VTK/Wrapping/Python/vtk
export PYTHONPATH=$PYTHONPATH:/home/doriad/bin/ParaView3/VTK/Wrapping/Python/:/home/doriad/bin/ParaView3/VTK/Wrapping/Python/vtk


Try to run the script again. If you get something like this:
Try to run the script again. If you get something like this:
ImportError: libvtkCommonPythonD.so.pv3.7: cannot open shared object file: No such file or directory
ImportError: libvtkCommonPythonD.so.pv3.7: cannot open shared object file: No such file or directory


Add the following to ~/.bashrc
Add the following to ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/lib:/home/doriad/bin/ParaView3/bin
export LD_LIBRARY_PATH=/usr/local/lib:/home/doriad/bin/ParaView3/bin

Revision as of 13:57, 30 January 2010

There are two main ways to install VTK - 1) as part of Paraview or 2) stand alone. In the following instructions, I've built Paraview and VTK has been installed as part of that process. I have built paraview in '/home/doriad/bin/ParaView3'

To run a vtk python script, simply type:

python script.py

If you receive this error:

ImportError: No module named vtk

add the following line to ~/.bashrc

export PYTHONPATH=$PYTHONPATH:/home/doriad/bin/ParaView3/VTK/Wrapping/Python/:/home/doriad/bin/ParaView3/VTK/Wrapping/Python/vtk

Try to run the script again. If you get something like this:

ImportError: libvtkCommonPythonD.so.pv3.7: cannot open shared object file: No such file or directory

Add the following to ~/.bashrc

export LD_LIBRARY_PATH=/usr/local/lib:/home/doriad/bin/ParaView3/bin