opencv_python关于Qt的错误
生活随笔
收集整理的這篇文章主要介紹了
opencv_python关于Qt的错误
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
問題
在mac 上使用OpenCV-Python時,程序出錯,提示信息如下:
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.這還是使用Anaconda的python環境。
問題是說,在系統里找到了2個Qt的執行二進制環境,系統也不知道用哪一個。
解決
沒想到網上也有很多人碰到這個問題。一個辦法是讓系統知道加載哪一個Qt環境,一種辦法是讓系統里只有一個Qt環境可用。
那就簡單地去掉一個,讓OpenCV-Python不帶Qt就好。
$ pip uninstall opencv-python Uninstalling opencv-python-4.2.0.32:Would remove:/Users/david/anaconda2/lib/python2.7/site-packages/cv2/*/Users/david/anaconda2/lib/python2.7/site-packages/opencv_python-4.2.0.32.dist-info/* Proceed (y/n)? ySuccessfully uninstalled opencv-python-4.2.0.32然后在重新安裝 opencv-contrib-python-headless,這里是contrib,可以將依賴的opencv_python一起安裝好。
$ pip install opencv-contrib-python-headless再執行開始的出錯的程序,一切OK 了。
總結
以上是生活随笔為你收集整理的opencv_python关于Qt的错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 全员进化!ROG 2023新品发布会定档
- 下一篇: 记录sqlserver中使用变量