【问题标题】:Process finished with exit code 134 (interrupted by signal 6: SIGABRT) in Python and OpenCV进程在 Python 和 OpenCV 中以退出代码 134(被信号 6:SIGABRT 中断)完成
【发布时间】:2019-12-05 09:51:24
【问题描述】:

考虑:

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Our operations on the frame come here
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    # Display the resulting frame
    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()

我在 PyCharm IDE 中使用 Python 和 OpenCV。当我尝试使用 OpenCV 打开网络摄像头时,出现以下错误:

进程以退出代码 134 结束(被信号 6:SIGABRT 中断)

发生这种情况是因为我的内存不足了吗? 有什么解决办法?

我在 MacBook Pro 上使用 PyCharm(操作系统:macOS v10.14 (Mojave))。

【问题讨论】:

标签: python opencv pycharm


【解决方案1】:
  1. 打开 /Applications/PyCharm.app/Contents/info.plist,
  2. 插入新行:

    • 关键:隐私 - 相机使用情况
    • 类型:字符串
    • 值:PyCharm 中的应用程序想要使用相机。
  3. 保存。

  4. 重新打开 PyCharm。
  5. 运行您的代码。

【讨论】:

  • 实际版本的PyCharm中已经包含了,但是还是不行!
【解决方案2】:

因为这个原因,我在JetBrains 打开了an issue。但这里有一个解决方法:

已经已获准访问相机的应用程序中运行 PyCharm 或 IntelliJ IDEA(无论 JetBrains 应用程序)。例如,我使用Hyper 终端运行IDE,一切正常。

【讨论】:

    【解决方案3】:

    通过在Visual Studio Code 中运行 Python 脚本,它将执行程序而不会出现任何警告或错误。

    【讨论】:

      【解决方案4】:

      在任何文本编辑器中打开文件/Applications/PyCharm.app/Contents/info.plist

      dictplist标签前添加这两行:

              <key>Privacy - Camera Usage</key>
              <string>An application in PyCharm wants to use the camera.</string>
          </dict>
      </plist>
      

      【讨论】:

        猜你喜欢
        • 2020-09-13
        • 2019-10-13
        • 2022-12-14
        • 2021-12-31
        • 1970-01-01
        • 2018-06-21
        • 2020-07-02
        • 2020-12-05
        • 2021-09-12
        相关资源
        最近更新 更多