【 Solutions 】解決 ImportError: libGL.so.1: cannot open shared object file: No such file or directory 問題

問題

  • 執行 cv2 時出現下方錯誤訊息
Traceback (most recent call last):
  File "app.py", line 35, in <module>
    from deepface import DeepFace
  File "/usr/local/lib/python3.8/site-packages/deepface/DeepFace.py", line 15, in <module>
    from deepface.basemodels import VGGFace, OpenFace, Facenet, Facenet512, FbDeepFace, DeepID, DlibWrapper, ArcFace, Boosting
  File "/usr/local/lib/python3.8/site-packages/deepface/basemodels/VGGFace.py", line 5, in <module>
    from deepface.commons import functions
  File "/usr/local/lib/python3.8/site-packages/deepface/commons/functions.py", line 4, in <module>
    import cv2
  File "/usr/local/lib/python3.8/site-packages/cv2/__init__.py", line 8, in <module>
    from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

解決方案

  • 請執行下方指令
sudo apt-get update && apt-get install -y ffmpeg libsm6 libxext6

GitHub

List of blogs