1

Till 1 hour back my opencv code was working perfectly fine. it could run my script without error. but I don't know why some time back suddenly it started giving me this error:

AttributeError: partially initialized module 'cv2' has no attribute 'imread' (most likely due to a circular import)
Traceback (most recent call last):
  File "FACEDETECTION.PY", line 1, in <module>
    import cv2
  File "C:\Users\Lenovo\anaconda3\envs\CAM\lib\site-packages\cv2\__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import

So what could be the error?

update: Here is my code-

import cv2
import pytesseract


pytesseract.pytesseract.tesseract_cmd = "C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe"

path = "text.png"
img = cv2.imread(path)

img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
text = pytesseract.image_to_string(img)


print(text)


cv2.imshow("name", img)
cv2.waitKey(7000)
Aditya Nambidi
  • 101
  • 2
  • 13
  • Please try to add your code too – Yunus Temurlenk Jul 09 '20 at 06:26
  • @YunusTemurlenk Done. Although this is not the only script that isn't working. none of the OpenCV scripts are working. – Aditya Nambidi Jul 09 '20 at 06:52
  • 1
    Similar error [here](https://stackoverflow.com/questions/59762996/how-to-fix-attributeerrorpartially-initialized-module). You should change the name of `cv2.py` if it exists in working directory. – Burak Jul 09 '20 at 13:19

0 Answers0