0

I am facing some import error....But cv2 was succesfully installed in my mac....Pls provide some solution

This is my code

import cv2

img=cv2.imread("galaxy.jpg",1)

print(img)

This is output

akshitdudeja@Akshits-MacBook-Air Sec-17 % python3 script.py
Traceback (most recent call last):
  File "/Users/akshitdudeja/VS Code/main_folder/UDEMY/Sec-17/script.py", line 1, in <module>
    import cv2
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/__init__.py", line 180, in <module>
    bootstrap()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/__init__.py", line 152, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so, 0x0002): tried:
'/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cv2/cv2.cpython-310-darwin.so' (mach-o file, but is an incompatibl
e architecture (have 'arm64', need 'x86_64')), '/usr/lib/cv2.cpython-310-darwin.so' (no such file)

enter image description here

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Akshit
  • 1
  • 1
  • As far as I know, there is no official release of OpenCV for Python 3.10 (because there is no official release of NumPy for Python 3.10). See [NumPy 1.21.2 may not yet support Python 3.10](https://stackoverflow.com/questions/69458399/numpy-1-21-2-may-not-yet-support-python-3-10) – Rotem Nov 09 '21 at 15:51
  • Plain and simple error "(have 'arm64', need 'x86_64')". You've downloaded something for windows and not mac os. – ZF007 Nov 11 '21 at 19:16

0 Answers0