Cv2.imshow() crashes kernel on Mac OS

cv2.imshow() crashes kernel on Mac OS. I will try the same code on windows everything is working perfectly but on MAC os its not. In mac os plt.imshow() working. My MAC OS is 10.15.3

in that case try writing

cv2.waitKey(10000)
cv2.destroyAllWindows()

after cv2.imshow()