Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve this error of "Cannot find reference 'imread' in '__init__.py" in python after installing opencv?

I am new to python and installed opencv by typing: pip install opencv-contrib-python in the command prompt.

Below I have shown a very simple example of reading in an image and showing it on the screen:

enter image description here

However, I get this error:

enter image description here

When I hover over the imread method in PyCharm, it says Cannot find reference 'imread' in '__init__.py'

It was showing import and runtime errors when I typed import cv2 and import numpy in the command prompt.

I tried going back to the previous version of NumPy by typing pip install --force-reinstall numpy=1.19.3. So, now when I type import cv2 and import numpy in the command prompt, it shows no error but it says it still can't find a reference to it in PyCharm.

I am using Python 3.9.1 with pip 20.2.3.

like image 440
Killjoy Avatar asked Jan 27 '26 23:01

Killjoy


1 Answers

If you are using python interpreter with anaconda change it to default python one. if you have not installed python separately then install it and assign the path to it.

somewhat this will be the path

c://user/APpData/Local/Programs/Python/python39/python.exe

like image 194
Peter Sunny Shanthveer Markapp Avatar answered Jan 29 '26 11:01

Peter Sunny Shanthveer Markapp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!