摘要:python cv2报错:ImportError: libGL.so.1: cannot open shared object file: No such file or directory...
Traceback (most recent call last): File "/www/python/***.py", line 11, in import cv2 as cv File "/root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/cv2/__init__.py", line 181, in bootstrap() File "/root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/cv2/__init__.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/root/.pyenv/versions/3.8.5/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: libGL.so.1: cannot open shared object file: No such file or directory [root@localhost ~]# /root/.pyenv/versions/3.8.5/bin/python3 /www/python/*****.py Traceback (most recent call last): File "/www/python/****.py", line 11, in import cv2 as cv File "/root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/cv2/__init__.py", line 181, in bootstrap() File "/root/.pyenv/versions/3.8.5/lib/python3.8/site-packages/cv2/__init__.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/root/.pyenv/versions/3.8.5/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: libGL.so.1: cannot open shared object file: No such file or directory
同时安装如下即可。
pip3 install opencv-python==4.5.4.58 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install opencv-python-headless==4.5.4.58 -i https://pypi.tuna.tsinghua.edu.cn/simple