繁体   English   中英

Python cv2.imshow() 因 Abort 陷阱崩溃:6

[英]Python cv2.imshow() crashes with Abort trap: 6

我的代码:

import cv2
print(cv2.__version__)
img = cv2.imread("img.jpg")
print(len(img))
print("now showing")
cv2.imshow("img",img)
cv2.waitkey(0)

我也试过waitkey(1)但错误似乎发生在cv2.imshow行(第 6 行)

错误跟踪:

objc[73658]: Class RunLoopModeTracker is implemented in both /Users/j/opt/anaconda3/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x110aca7f0) and /Users/j/opt/anaconda3/lib/libQt5Core.5.9.7.dylib (0x128e18a80). One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7f80b2434fa0) is not the object's thread (0x7f80b244ec40).
Cannot move to target thread (0x7f80b2434fa0)

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.

Abort trap: 6

我遇到了同样的问题并找到了解决方案。

  1. pip 卸载 opencv-python 或 opencv-contrib-python

  2. pip 安装 opencv-python-headless

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM