python - python-opencv-headless 的问题

标签 python azure pip conda opencv

我曾经使用conda yml文件在我的服务器上安装opencv,如下所示

name: project_environment
dependencies:
- python=3.6.2
- pip=20.2.4

- pip:
  - pillow
  - numpy
  - opencv-python-headless==4.5.3.56
  - torch
  - torchvision
  - face-alignment==1.3.4
  - tensorflow==2.5.0
  - cmake
  - dlib
  
channels:
- anaconda
- conda-forge

之前,它可以正常工作,但是昨天我运行脚本时,出现错误

from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

如果我安装 python-opencv,而不是 headless 版本,应该会出现此错误。 我该如何调试,哪个包导致了问题。

最佳答案

谢谢skvark 。将您的建议作为答案发布以帮助其他社区成员。

Other alternative is to run sudo apt-get install -y libgl1-mesa-dev which will provide the missing libGL.so.1 if you want to use opencv-python. The libgl1-mesa-dev package might be named differently depending on your GNU/Linux distribution.

您可以引用Error trying to import cv2(opencv-python) package , ImportError: libGL.so.1: cannot open shared object file: No such file or directoryImportError: libGL.so.1: cannot open shared object file: No such file or directory

您还可以引用 GitHub 上已关闭的问题:libGL.so.1: cannot open shared object file: No such file or directory

关于python - python-opencv-headless 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70120507/

相关文章:

python - 反转为 'product',没有找到参数。尝试了 1 个模式 : [u'products/(? P<product>[-\\w]+)/$']

Azure SQL 数据库-随机错误 : Login failed for user '***'

python - 为什么无法在 Mac 上添加 Azure DB 扩展?

python - virtualenv安装SSL错误: The read operation timed out

python - Heroku 未能满足安装 pip 要求

python 使用 selenium,错误 : chrome unexpectedly exited. 状态代码为:0

python - 当 Min_count=1 时,Groupby 和等于 0

python - 基于用户输入的菱形形状

azure - 如何使用 Azure EventGrid Webhook 维护幂等性?

python - 定义正确的requirements.txt文件