[OpenCV] M1 Mac에서 이슈 정리

오준석·2023년 9월 17일
0

코딩삽질방지

목록 보기
44/51

M1 Mac 에서 OpenCV 사용시 겪은 이슈 정리이다.

1. 실행창이 종료되지 않는 현상

윈도우 OS에서는 다음 코드로 실행창이 잘 닫힌다

cv2.destroyAllWindows()

mac 에서는 완전히 종료가 안 되어 강제종료 해야 한다.

검색해 보면 뒤에 뒤에 waitKey(1) 을 여러개 넣으면 해결된다고 하는데 나는 안 되었다.

cv2.destroyAllWindows()
cv2.waitKey(1)
cv2.waitKey(1)
cv2.waitKey(1)
cv2.waitKey(1)

해결

다음 링크를 참고하여 mac 에서는 destroyAllWindows() 를 실행하지 않고 재사용 하는 것으로 결론 내렸음

https://stackoverflow.com/questions/6116564/destroywindow-does-not-close-window-on-mac-using-python-and-opencv

2. 주피터 노트북 확장 설치 권한 에러

다음 명령으로 확장 기능 설치시 권한 문제가 발생한다

!pip install jupyter_contrib_nbextensions
!jupyter contrib nbextension install

다음과 같은 에러가 나온다.

PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter'

해결

--user를 붙이면 해결된다.

!pip install jupyter_contrib_nbextensions
!jupyter contrib nbextension install --user
profile
교육하고 책 쓰는 개발자

0개의 댓글