IT이야기

[Python] AttributeError: module 'cv2.dnn' has no attribute 'DictValue'

백련산넷돌이 2025. 2. 4. 11:38
반응형

Nvidia 의 Sana 오픈소스를 실행시 아래와 같이 에러가 발생합니다. 

AttributeError: module 'cv2.dnn' has no attribute 'DictValue'

ImportError 내용

ImportError: module 'cv2.dnn' has no attribute 'DictValue'

 

https://boysboy3.tistory.com/172 님의 글을 참고하여 opencv 버전문제로 보이지만, 저는 최신 버전

(Name: opencv-python
Version: 4.11.0.86) 을 사용하고 있어서 이단계는 pass 입니다. 그리고 그 다음 2단계를 통해서 에러 수정입니다.

==========================퍼온 글========================================================

인터넷글을 찾아보니 다음과 같이 opencv 문제로 버전문제라고 버전을 바꾸라고 나와있다.

pip install opencv-python==4.8.0.74

 

하지만 위와 같이 버전을 바꿔도 오류가 지속적으로 발생하여 구글링을 해본 결과 다음과 같은 방법으로 해결할 수 있었다.

 

# 1. download the autofix tool
pip install opencv-fixer==0.2.5
# 2. execute
python -c "from opencv_fixer import AutoFix; AutoFix()"

===========================================================================================

위와 같이 opencv-fixer 를 통해서 관련 패키지 opencv-fixer, opencv-python 를 uninstall 하고 다시 install 하여

에러를 해결 했습니다.

 

 

출처: https://boysboy3.tistory.com/172 [When will you grow up?:티스토리]

반응형