Are there separate instructions to install OpenCV to a Python 3.6 installation?

asked 2019-07-01 05:32:15 -0500

Hi, I followed the instructions to install OpenCV onto a Python 3.6 install on this page: https://docs.opencv.org/4.1.0/d5/de5/...

I'm aware the instructions are for a 2.7 install and the file listed in the instructions is cv2.pyd. I made a similar attempt to install openCV to a Python 3.6 install by moving the file cv2.cp36-win_amd64.pyd to the C:\python36\Lib\site-packages directory. When type import cv2 as cv, I get:

>>> import cv2
Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    import cv2
ImportError: DLL load failed: The specified module could not be found.

When I type cv2.cp36-win_amd64.pyd as cv I get

>>> import cv2.cp36-win_amd64.pyd as cv
SyntaxError: invalid syntax

Question: Is there a separate page to install OpenCV into a Python 3.6 install? Do I need to copy over a DLL to another directory somewhere?

Installation instructions from the page link above (numpy and matplotlib were installed successfully):

Installing OpenCV from prebuilt binaries

Below Python packages are to be downloaded and installed to their default locations.
    Python 3.x (3.4+) or Python 2.7.x from here.
    Numpy package (for example, using pip install numpy command).
    Matplotlib (pip install matplotlib) (Matplotlib is optional, but recommended since we use it a lot in our tutorials).
Install all packages into their default locations. Python will be installed to C:/Python27/ in case of Python 2.7.
After installation, open Python IDLE. Enter import numpy and make sure Numpy is working fine.
Download latest OpenCV release from GitHub or SourceForge site and double-click to extract it.
Goto opencv/build/python/2.7 folder.
Copy cv2.pyd to C:/Python27/lib/site-packages.
Open Python IDLE and type following codes in Python terminal.
>>> import cv2 as cv
>>> print( cv.__version__ )

If the results are printed out without any errors, congratulations !!! You have installed OpenCV-Python successfully.

edit retag flag offensive close merge delete