[라즈베리파이]opencv-python 설치 및 No module named 'cv2' 해결

2022. 5. 19. 20:17프로젝트 로그/테스트x솔루션 JIG 개발기

반응형

라즈베리파이에서 pip install opencv-python으로 Python OpenCV를 설치하고 실행하면, 아래와 같이 RuntimeError가 발생 했다.

아래와 같이 numpy 버전을 업그레이드 하면 해당 문제를 피할 수 있다.

 

$ pip install numpy --upgrade

 

pi@raspberrypi:~/testCameraServer $ python PyqtQRScanSingleThread.py 
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd
Traceback (most recent call last):
  File "/home/pi/testCameraServer/PyqtQRScanSingleThread.py", line 10, in <module>
    import cv2
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/home/pi/.local/lib/python3.9/site-packages/cv2/__init__.py", line 8, in <module>
    from .cv2 import *
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
ImportError: numpy.core.multiarray failed to import



>> pip install numpy --upgrade

 

 

반응형