Available platform plugins are: cocoa, minimal, offscreen


PySide2를 활용하여 이미지를 띄워주는 간단한 Qt 애플리케이션을 만들어서 실행했을때 아래와 같은 에러가 발생함

실행환경

  • Mac
  • Python 3.7.7

에러 메세지

QObject::moveToThread: Current thread (0x7f98698e9060) is not the object's thread (0x7f9867eea4f0).
Cannot move to target thread (0x7f98698e9060)

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "" 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: cocoa, minimal, offscreen.

해결방법

Anaconda로 환경을 구성했었는데 pyside2는 pip으로 설치를 했었다. 아래와 같이 conda 명령어로 pyside2를 다시 설치해줘서 해결함

conda install -c conda-forge pyside2