python use opencv get an error -
when use opencv python, error. set environment this:
- install python "python-2.7.5.msi"
- install numpy "numpy-mkl-1.7.1.win32-py2.7.exe"
- install opencv "opencv-python-2.4.6.win32-py2.7.exe"
everything ok. test using following code:
import cv2 img = cv2.imread('lena.bmp') cv2.show('image', img) cv2.waitkey(0)
but got error follow:
file "e:\python\cv2.py", line 1, in <module> import cv2 file "e:\python\cv2.py", line 2, in <module> img = cv2.imread('lena.bmp') attributeerror: 'module' object has no attribute 'imread'
why? when print "import cv2" in idle, didn't error.
well, guess imported file, ie file writing. cause file using name "cv2.py" suggested. you`d better change filename.
Comments
Post a Comment