This section describes how to install ITK with python wrappings on Fedora 19 or 20, or Ubuntu 14. This can of course be extended to other Linuxes.
Step 1: Dependencies
Fedora 20 has very few packages installed y default, so you may have to install them manually.
On Fedora 20:
- yum install gcc
- yum install python-devel
- yum install vxl
Python will need to be installed along with the Python development headers (Python.h), which is not the case on most platforms:
- Install the python-devel package.
Step 2: Setup the build
Clone the git repository in /home/yourname/ITK:
- git clone git://itk.org/ITK.git
- git checkout tags/v4.5.2 # Optional, if you want to use a stable version
Create a build directory, it is recommended to build outside of the source directory:
- mkdir build
- cd build
Use cmake to configure your build
- ccmake ../ITK -DITK_WRAP_PYTHON=ON
Set different variables, you may have to configure [C] the build 2 or 3 times. Use the advanced mode [T] to see all the possibilities.
- ITK_WRAP_PYTHON = ON
- BUILD_SHARED_LIBS = ON
- PYTHON_EXECUTABLE = /usr/bin/python
- USE_SYSTEM_SWIG=OFF # Will use ITK's swig (recommended)
On Fedora 19 or 20:
- PYTHON_INCLUDE_DIR = /usr/include/python2.7
- PYTHON_LIBRARY = /usr/lib64/libpython2.7.so.1.0
- PY_SITE_PACKAGES_PATH = /usr/lib64/python2.7/site-packages
On Ubuntu 14:
- PYTHON_INCLUDE_DIR = /usr/include/x86_64-linux-gnu/python2.7
- PYTHON_LIBRARY = /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
- PY_SITE_PACKAGES_PATH = /usr/lib/python2.7/dist-packages
Once configuration is finished, you may now generate the needed files by pressing [g].
Step 3: Run the build
Step 4: Install
You need to have root access to install ITK (if you left the default installation path):
- su # Type your root password
- make install
On Ubuntu: Here, the super-user account is disabled by default, run the install step like this:
- sudo make install # Type your root password
ITK will install by default in /usr/local/lib. Now, you have to tell the system that the files have been installed here.
- cd /etc/ld.so.conf.d/
- add a file called itk-46.conf, which should contain only one line: /usr/local/lib
- ldconfig # tells the system to read the files in ld.so.conf.d
Step 5: Test your installation
- import itk
This should run without producing an error.