python 에서 OpenCV 를 사용하거나 QT 를 다루다보면 종종 아래와 같은 문제가 발생하기도 한다
QObject::moveToThread: Current thread (0x557f778d2d20) is not the object's thread (0x557f765b2450).
Cannot move to target thread (0x557f778d2d20)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ubuntu/anaconda3/envs/torch3.8/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.
Aborted (core dumped)
사용중인 가상환경에서 opencv-python 을 지우고 openv-python-headless 를 설치하는 방법으로 해결 가능하다
pip uninstall opencv-python
pip install opencv-python-headless
예전엔 이게 안먹혀서 해결하는데 꽤나 고생했던걸로 기억하는데 이번엔 생각보다 간단하게 해결이 됐다
아래 링크에 다른 해결방법도 있으니 위 방법이 안먹히면 참고
'Programming > Python' 카테고리의 다른 글
Pycharm import 빨간 줄 없애기 (0) | 2023.06.20 |
---|---|
[Python] Scikit-image TypeError: rescale() got an unexpected keyword argument 'multichannel' (0) | 2023.03.15 |
[Python] list를 부분 분리 할 때 사용하는 '*' (0) | 2022.10.06 |
[Ubuntu][python] pip install 사용시 발생하는 UnicodeDecodeError 해결방법 (0) | 2020.06.02 |
[Python] 반복문에서 진행결과 (Progress bar) 표시하기 (0) | 2020.01.15 |