Python cv2.imshow () падает с прерыванием прерывания: 6 - PullRequest
1 голос
/ 10 февраля 2020

Мой код:

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 Ответ

1 голос
/ 12 февраля 2020

Я столкнулся с той же проблемой и нашел решение.

  1. pip uninstall opencv- python или opencv-contrib- python

  2. pip install opencv- python -headless

...