解决from .cv2 import *ImportError: libGL.so.1: cannot open shared object file: No such file or directo
Posted 沉迷单车的追风少年
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决from .cv2 import *ImportError: libGL.so.1: cannot open shared object file: No such file or directo相关的知识,希望对你有一定的参考价值。
项目场景:
pytorch 二维草图 特征提取 三维重建训练
问题描述:
Traceback (most recent call last):
File "sketch_gcn.py", line 13, in <module>
from utils.sketch_processing import make_graph
File "/root/SketchHealer/utils/__init__.py", line 1, in <module>
from .sketch_processing import *
File "/root/SketchHealer/utils/sketch_processing.py", line 2, in <module>
import cv2
File "/root/anaconda3/envs/dpm-pc-gen/lib/python3.7/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
原因分析:
cv2的依赖库问题
解决方案:
依次执行:
pip install opencv-contrib-python
sudo apt-get install -y libgl1-mesa-dev
sudo apt-get update
以上是关于解决from .cv2 import *ImportError: libGL.so.1: cannot open shared object file: No such file or directo的主要内容,如果未能解决你的问题,请参考以下文章
模块导入from collections import Iterator,Iterable失败
import cv2 报错:ModuleNotFoundError: No module named 'cv2'