Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Python import cv error on OpenCV 3.0.0 (no error for import cv2)

I am using a Windows 10 machine with Python 2.7.x and OpenCV 3.0.0 installed and both work fine. I followed the official link for installation of the same along with numpy and matplotlib. I get an error saying:

ImortError: No module named cv

when I try to run the following code:

import cv2
import numpy as np
import cv

def diceroll():
    rng = cv.RNG(np.random.randint(1,10000))
    print 'The outcome of the roll is:'
    print int(6*cv.RandReal(rng) + 1)
    return 

diceroll()

I have also tried using cv2.cv instead of cv(and not use import cv) but then I get an error saying:

AttributError: 'module' object has no attribute 'cv'

Implying cv2 does not have cv attribute. Is there a way I can get it to work? I have just followed the link given above and not appended any python path or set environment variables for openCV