Which version of OpenCV for Python 2.7? Importing error/Installation

asked 2015-10-20 05:16:48 -0500

wmbm gravatar image


I followed these installation instructions very closely: http://opencvpython.blogspot.de/2012/...

The installation procedure is as follows (windows):

  1. Download current version of opencv (opencv-3.0.0.exe)
  2. Extract to C:\Python27\Lib\site-packages\opencv
  3. Import into Spyder (import cv2)

But when I try to import cv2 in my Spyder tool (Python version 2.7) claims there is no module named cv2.

Is this possibly a compatibility issue? Do I need to set a new path in Spyder? Maybe missing an additonal step?

Many thanks, Will

edit retag flag offensive close merge delete


try with a plain python run from a cmdline

berak gravatar imageberak ( 2015-10-20 08:02:26 -0500 )edit

also says "no such file or directory"

wmbm gravatar imagewmbm ( 2015-10-20 10:28:01 -0500 )edit

it should go into C:\Python27\Lib\site-packages (no additional opencv folder)

then, go and look at the size of your cv2.pyd.

> 10mb ? static build. should not depend on additional opencv dlls at runtime

< 10mb ? dynamic build. you need the opencv dlls on the PATH env var to make it happen

berak gravatar imageberak ( 2015-10-20 10:35:33 -0500 )edit

it's 33mb file. Any next steps? I now receive an error File "cv2.pyd", line 1 SyntaxError: Non-ASCII character '\x90' in file cv2.pyd on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

wmbm gravatar imagewmbm ( 2015-10-20 14:31:48 -0500 )edit

again put it into C:\Python27\Lib\site-packages and try without spyder

berak gravatar imageberak ( 2015-10-20 14:38:20 -0500 )edit

same issue. After extracting the downloaded file, I'm copying cv2.pyd from opencv2/build/python/2.7/x64 into C:\Python27\Lib\site-packages. Then in command window typing "python cv2.pyd"

wmbm gravatar imagewmbm ( 2015-10-20 15:17:11 -0500 )edit

wait, you don't execute cv2.pyd directly. try:


import cv2

berak gravatar imageberak ( 2015-10-20 15:46:25 -0500 )edit