Python在MacOS Mojave中与OpenCV一起崩溃



我的OpenCV程序在我升级MacBook到MacOS Mojave后不久就坏了。

安装了以下组合,似乎没有任何效果。

Python 3.6.5 with OpenCV 3.4.1

Python 3.7.0 with OpenCV 3.4.3

简单的测试程序

import cv2
vid = cv2.VideoCapture(0)
while True:
_, frame = vid.read()
cv2.imshow("Frame", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
vid.release()
cv2.destroyAllWindows()

崩溃日志的一部分(完整日志单击此处(

Process:               Python [23472]
Path:                  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python
Version:               3.7.0 (3.7.0)
Code Type:             X86-64 (Native)
Parent Process:        zsh [22997]
Responsible:           Python [23472]
User ID:               501
Date/Time:             2018-10-09 14:39:32.725 +0800
OS Version:            Mac OS X 10.14 (18A391)
Report Version:        12
Anonymous UUID:        D946F646-E90A-A450-14FB-63EA96A4C90E

Time Awake Since Boot: 18000 seconds
System Integrity Protection: disabled
Crashed Thread:        3  Dispatch queue: com.apple.root.default-qos
Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY
Termination Reason:    Namespace TCC, Code 0x0

根据 @w-m 的建议,显然,最新的 macOS 变体在所有应用程序之上灌输了严格的安全层。

现在,当我使用本机终端应用程序时,我才能调用相机。 希望iTerm将很快推出更新。

干杯!

更新(6/11/2018(:iTerm 发布了一个更新,将要求相机权限。

最新更新