gpt4 book ai didi

python - Opencv imshow在macOS 11.0.1(Big Sur)上使python启动器崩溃

转载 作者:行者123 更新时间:2023-12-03 15:25:59 24 4
gpt4 key购买 nike

当我发现python启动器在尝试执行imshow函数时被卡住时,我正在尝试从高斯过滤器运行一些旧代码。
我试过了:

  • 使用Matplotlib来显示图形,以查看python启动器是否有问题,但没有,图形显示正常。
  • 删除进程之间只是为了读取和显示图像,以免我的代码中的某些内容破坏了启动器,但没有成功。
  • 重新安装了opencv-python,但未成功。

  • 在Google搜索中还看到了这样的一个问题,但OP删除了它。
    有没有人遇到此问题或对此有任何解决办法?
    示例代码:
    import cv2 as cv
    filename = 'chessboard.png'
    img = cv.imread(filename)
    cv.imshow('dst',img)
    cv.waitKey(0)
    操作系统:MacOS Big Sur(11.0.1)

    最佳答案

    我通过以下步骤解决了该问题:

  • 安装anaconda。
  • 安装所需的库。
  • 运行脚本,出现以下错误:

  • 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.


  • ,然后我安装了两个库:
  • pip install opencv-python opencv-python-headless
  • 重试运行该脚本,该图像可以显示在监视器的左上方。
  • 关于python - Opencv imshow在macOS 11.0.1(Big Sur)上使python启动器崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64838511/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com