0

I'm a beginner in coding and want to learn machine learning. So I've installed Anaconda 4.4.1 and python 3.6 and Open CV 3. I've done everything as told in this website https://chrisconlan.com/installing-python-opencv-3-windows/. After installing, I tried running a short line of code which goes like this:

import numpy as np

import cv2

img = cv2.imread('dog.jpg', 0)

print(img)

The output was this:

runfile('C:/Users/Russell/Desktop/Python_Test/cv2 test.py', wdir='C:/Users/Russell/Desktop/Python_Test')
Traceback (most recent call last):

  File "<ipython-input-1-8ac86397d1f0>", line 1, in <module>
    runfile('C:/Users/Russell/Desktop/Python_Test/cv2 test.py', wdir='C:/Users/Russell/Desktop/Python_Test')

  File "C:\Anaconda\envs\myWindowsCV\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda\envs\myWindowsCV\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Russell/Desktop/Python_Test/cv2 test.py", line 2, in <module>
    import cv2

  File "C:\Users\Russell\Desktop\Python_Test\cv2.py", line 4, in <module>
    img = cv2.imread('dog.jpg')

AttributeError: module 'cv2' has no attribute 'imread'

Can anyone help me with this? Would really appreciate it.

f5r5e5d
  • 3,656
  • 3
  • 14
  • 18
Chua
  • 13
  • 3

0 Answers0