I was able to use openCV for 32-bit python however I had to switch to 64-bit to use tensorflow.
I did follow the instructions of from the opencv page here.
H
Here are the steps I followed to get OpenCV 4.2 to run on Python 3.7.6 (x86-64) in Windows 10:
C:\
ENABLE_SOLUTIONS_FOLDER
:
(Optional) Enable the build of opencv_contrib module: this is an external module that doesn't ship with OpenCV source code. To allow OpenCV to build it, you need to clone this GitHub repo somewhere in your computer. Then, simply find and initialize the OPENCV_EXTRA_MODULES_PATH
with the location of <opencv_contrib>/modules
. For example, in my computer the correct path would be something like: C:\opencv_contrib\modules
After adjusting all the flags that you want (or need), simply click the Generate button to create the VS project that you will use to build OpenCV. When it finishes, the button Open Project will be enabled. Click on it to open Visual Studio:
import cv2
.If you encounter errors while building the INSTALL script, you might have to close Visual Studio and open it with Administrator privileges so that it can install the cv2
package for python.
I thought had the same problem after I upgraded to python 3.6.2 64bit architecture. But it turned out that I was installing by..
pip install cv2
... on python 3.6.2 x64 instead of..
pip install opencv-python