Move the sources to trunk
[opencv] / docs / python-wrappers-on-windows.txt
1 A quick HOWTO for installing the Python wrappers on Windows. Taken
2 from an email I have send to OpenCV support. At least one positive
3 feed-back.
4
5 The setup.py file can be found in interfaces/swig/python and is named
6 setup-for-win.py
7
8 Look at http://groups.yahoo.com/group/OpenCV/ if you have any
9 comments, or if you need help about OpenCV.
10
11 Olivier Bornet.
12
13 ======================================================================
14
15 > Does anybody success to use it under Windows?
16
17 As they was no answers, I have borrow a Windows 2000 laptop at work to
18 test it last days... So, here is the answer: yes, you can build ans use
19 it on Windows with Python. :-)
20
21 Here is a quick howto (note that I don't use Windows at all, so maybe my
22 explanations are not always correct):
23
24  1. install the beta5 OpenCV distribution,
25     (http://sourceforge.net/projects/opencvlibrary/),
26  2. install ActivePython
27     (http://www.activestate.com/Products/ActivePython/),
28  3. run the attached setup.py to build and install the new OpenCV Python
29     wrapper:
30         python setup.py install
31  4. run one of the Python OpenCV samples.
32
33 And that's all. :-)
34 You maybe need to adapt opencv_base_dir in setup.py to reflect your
35 OpenCV installation.
36
37 Now, the problems I have had, or the problems you can encounter:
38
39   - my installation of OpenCV don't add the OpenCV path in the search
40     path, so I have added it manually, (but if the OpenCV C samples
41     works for you, this will be not needed),
42
43   - as I have an old Visual Studio 6.0, distutils has some problems, and
44     the install part (3) was saying something like "Python was built
45     with version 7.1 of Visual Studio, and extensions need to be built
46     with the same version of the compiler, but it isn't installed"
47     To correct this, I have edited
48     \python24\lib\distutils\msvccompiler.py and change the
49     get_build_version() function to return 6 directly... A quick and
50     dirty ack...
51
52   - some lines in _cv.cpp don't compile with VC6 (don't have tested with
53     recent MS C compiler, but it seems that at least long long is now
54     supported):
55     - PyAPI_FUNC,
56     - long long variables definitions.
57     So, I have remove the PyAPI_FUNC and changed long long to __int64. A
58     patch for making this is attached to this email.
59
60 After that, the samples are more or less running. At least contours.py
61 and convexhull.py are OK. capture-cam.py don't generate any file, and
62 cam-histo.py crash after cvCaptureFromCAM(0) call.
63
64 I don't know if these problems are related to my specific installation
65 or not. (Windows 2000, VC6, ...) And I don't want to make lot of things
66 ok Windows. So, I will stop here my tests...
67
68 ======================================================================