I installed the Python bindings of VTK 5.1 correctly. In Python, import vtk worked, but import itk did not work yet. So I wanted to install the Python bindings of ITK 4.2.

I needed to install SWIG 2.0.7, and from the error message which arose during ./configure in the SWIG source directory, I understood I needed to install pcre. So I chose the version 8.31 of pcre. Here is a summary of the process:

(VTK + Python) ---> This works.

(ITK + Python) ---> SWIG needed ---> pcre needed

Now that pcre is installed, my problem is yum has stopped working:

[root@wok build]# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
libvtkIOPythonD.so.5.10: cannot open shared object file: No such file or directory
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7 (r27:82500, Sep 16 2010, 18:02:00)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq

I wonder if I should add variables to the PATH.

Maybe it is related to a problem I had with SWIG: it worked as a user but not as root.

Now, I can import vtk as a user, and still use yum as root.
I cannot import vtk as root, but I never wanted to anyway.

In order to solve the problem, I first removed the .bashrc file and noticed it fixed yum. Then I proceeded to add the lines above to the PYTHONPATH to gain access to import vtk. Finally, I noticed ipython would not work when import vtk would work, and reciprocally.