Monday, April 13, 2009

How To Fill A Ziploc Bag With Hcl And Naking Soda

Compile VTK in python with Windows

Based on these instructions , I created a guide to compile the library VTK for Python under Windows.
 
1) Download and install:
  • CMake
  • Visual C + + Express (2008)
  • Python
 
2) Download the source files to vtk and extract them in a folder (for example VTK_SOURCE).
 
3) Create a new folder where to put the compiled files (eg BUILD).
 
4) Run CMake.
 
5) Set fields:
  • Where is the source code = VTK_SOURCE.
  • Where to build the binaries = BUILD.
 
6) Click on Configure and choose compiler as "Visual C 9 (2008)" .
 
7) Set the values:
  • VTK_WRAP_PYTHON = ON.
  • BUILD_SHARED_LIBS = ON.
 
8) Click on Configure.
 
9) If there are problems to solve, and click Configure each time. Here I report what I've encountered and solutions:
  • CMake Error at CMake/vtkWrapTcl.cmake:180 (MESSAGE): Tk was not found. Install the Tk development package (see http://tcl.tk or ActiveState Tcl) and set the appropriate variables (TK_INCLUDE_PATH, TK_LIBRARY, TK_WISH) or disable VTK_USE_TK. Call Stack (most recent call first): CMakeLists.txt:831 (INCLUDE).
  1. Abilitare la visualizzazione dei valori avanzati.
  2. Impostare VTK_USE_TK a OFF.
  • *CMake Error: The following variables are used in this project, but they are set to NOTFOUND.Please set them or make sure they are set and tested correctly in the CMake files: PYTHON_INCLUDE_PATH (ADVANCED). used as include directory in directory C:/Users/Giuseppe/Desktop/Nuova cartella/vtk-5.2.1.
  1. Abilitare la visualizzazione dei valori avanzati.
  2. Impostare PYTHON_INCLUDE_PATH alla cartella include presente nella cartella di Python (es.: C:/Python26/include).
  • *CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: PYTHON_LIBRARY (ADVANCED).
  1. Abilitare la visualizzazione dei valori avanzati.
  2. Set the file PYTHON_LIBRARY
  3. pythonXX.lib Python libs in the directory (eg C: / Python26/libs/python26.lib).
 
10) Click on OK when everything goes well.
 
11) Open the file in the folder INSTALL.vcproj build with Visual C + +.
 
12) From the Project menu, click Properties and then Configuration Manager and set the active configuration to Release.
 
13) Debug menu, click Start Debugging or F5.
 
14) Wait until the build (it may take a bit 'of time).
 
At this point I was able to build using Python25, while Python26 the 64-bit Visual Basic does not find definitions of entry points Python.

0 comments:

Post a Comment