반응형



Windows10에서 Python 3.7에 OpenCV 4.4.0를 설치후 다음과 같은 에러가 날 경우 해결방법입니다.

** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD  parameter number  2 had an illegal value
 ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\momo\AppData\Local\Programs\Python\Python37\lib\site-packages\cv2\__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import


 
다음처럼 pip를 사용하여 opencv 패키지를 설치한 후, 

C:\Users\momo>pip install opencv-contrib-python
Collecting opencv-contrib-python
  Downloading opencv_contrib_python-4.4.0.46-cp37-cp37m-win_amd64.whl (40.1 MB)
     |████████████████████████████████| 40.1 MB 1.7 MB/s
Collecting numpy>=1.14.5
  Downloading numpy-1.19.4-cp37-cp37m-win_amd64.whl (12.9 MB)
     |████████████████████████████████| 12.9 MB 2.2 MB/s
Installing collected packages: numpy, opencv-contrib-python
Successfully installed numpy-1.19.4 opencv-contrib-python-4.4.0.46
WARNING: You are using pip version 20.1.1; however, version 20.2.4 is available.
You should consider upgrading via the 'c:\users\momo\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip' command.



python에서 OpenCV 모듈 cv2를 임포트하는 순간 에러가 났습니다.

C:\Users\momo>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
 ** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD  parameter number  2 had an illegal value
 ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\momo\AppData\Local\Programs\Python\Python37\lib\site-packages\cv2\__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: numpy.core.multiarray failed to import
>>> quit()



해결방법은 간단합니다. OpenCV 4.4.0 설치시 디폴트로 설치되는 numpy 1.19.4 대신에 numpy 1.19.3을 다시 설치해주면 됩니다.


C:\Users\momo>pip install numpy==1.19.3
Collecting numpy==1.19.3
  Downloading numpy-1.19.3-cp37-cp37m-win_amd64.whl (13.2 MB)
     |████████████████████████████████| 13.2 MB 1.7 MB/s
Installing collected packages: numpy
  Attempting uninstall: numpy
    Found existing installation: numpy 1.19.4
    Uninstalling numpy-1.19.4:
      Successfully uninstalled numpy-1.19.4
Successfully installed numpy-1.19.3
WARNING: You are using pip version 20.1.1; however, version 20.2.4 is available.
You should consider upgrading via the 'c:\users\momo\appdata\local\programs\python\python37\python.exe -m pip install --upgrade pip' command.



numpy 버전을 바꾼 후, 테스트해보면 문제없이 cv2 모듈이 임포트 됩니다. 

C:\Users\momo>python
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.4.0'
>>>


반응형

문제 발생시 지나치지 마시고 댓글 남겨주시면 가능한 빨리 답장드립니다.

도움이 되셨다면 토스아이디로 후원해주세요.
https://toss.me/momo2024


제가 쓴 책도 한번 검토해보세요 ^^

+ Recent posts