第41月第28天 conda两个qt
1.
为什么包含两份Qt的二进制文件?
提示有两个Qt二进制文件的集合,如下:
objc[32802]: Class RunLoopModeTracker is implemented in both xxx and yyy. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7fefa3512020) is not the object's thread (0x7fffb38b9380).
Cannot move to target thread (0x7fefa3512020)
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.
This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".
Available platform plugins are: cocoa, minimal, offscreen.
Reinstalling the application may fix this problem.
原因是,在Mac系统中,使用brew安装一遍Qt,又使用conda安装一遍Qt,两个包重叠使用,卸载一个即可,优先卸载conda安装的Qt,执行以下操作:
brew install qt
brew install pyqt
conda uninstall pyqt
conda uninstall qt
我在将自己的MacOS重新安装一下后,想测试一下Python的opencv能不能用
然后就 pip install opencv-python
果不其然,在我测试打开摄像头代码的时候报了一个
qt.qpa.plugin: could not find the qt platform plugin “cocoa” in “”
当时各种Goole,百度都用上了。
最后得到的解决方法是
pip install opencv-python-headless
https://blog.csdn.net/weixin_43635647/article/details/104243317
https://www.jianshu.com/p/d34ad886b7fa