0. Run the import cv test and find that the opencv module is not installed.
First, the development environment is set up in the windows xp environment.
The three conditions must be ensured during the construction process:
1. python needs to install the python-numpy module, otherwise it will not be able to run even if the cv module is found. The error "ImportError: numpy. core. multiarray failed to import" will also occur.
When installing this module, you must ensure that the python version is consistent with the numpy version. For example, the current numpy version supports python2.6 at the maximum, therefore, if your python version is not 2.6, this module cannot be installed.
-------------------------------
Http://www.numpy.org/
Ubuntu & Debian
Sudo apt-get install python-numpy python-scipy python-matplotlib ipython-notebook python-pandas python-sympy python-nose
Download windows
Http://www.lfd.uci.edu /~ Gohlke/pythonlibs/
Numpy-MKL-1.7.1.win32-py2.7.exe (win32 bit)
Numpy-MKL-1.7.1.win-amd64-py2.7.exe (win 64-bit)
------------------------------------
The new version 1.7.1 is used above.
2. The python version must be consistent with the OpenCV version. Otherwise, an error occurs when importing the cv module.
For example, if you have installed Python 2.0, OpenCV needs to Install Version 2.2.
-------------------------
The OpenCV-2.3.1-win-superpack.exe is downloaded.
124 MB, in size.
This file is different from the directory structure of the OpenCV-2.4.6.0.exe file after decompression. I did not find the file location 2.4.6.
Use 2.3.1 temporarily.
\ Opencv231 \ opencv \ build \ python \ 2.7 directory:
Cv2.pyd
Cv. py
Copy two files to: D: \ Python27 \ Lib \ site-packages \
-------------------------
The 2.4.6 file is:
Opencv \ build \ python \ 2.7 \
Cv2.pyd
----------------
The problem that the relevant modules cannot be found when executing the import cv is described on the OpenCV Website:
"Python 2.6 bindings for OpenCV are supported ded within the package, but not installed. you can copy the subdirectory opencv/Python2.6/Lib/site-packages into the respective directory of the Python installation. this procedure will be automatically in the next OpenCV update."
That is, we only need to copy the files in Python2.6/Lib/site-packages under the OpenCV installation directory to the Lib/site-packages under the Python2.6 installation directory.
Using the above method, the development environment of Python and OpenCV is successfully matched!
-------------
Enter here
Opencv231 \ opencv \ samples \ python
There is a drawing. py file to run.
----------
Reference address:
Http://blog.csdn.net/mengyafei43/article/details/10338531
And so on.