在Amazon Linux2 做yolo训练时,报如题错误。
yolo train data=coco128.yaml model=yolov8n.pt epochs=10 lr0=0.01
Traceback (most recent call last):
File "/home/ec2-user/.local/bin/yolo", line 5, in <module>
from ultralytics.cfg import entrypoint
File "/home/ec2-user/.local/lib/python3.7/site-packages/ultralytics/__init__.py", line 5, in <module>
from ultralytics.hub import start
File "/home/ec2-user/.local/lib/python3.7/site-packages/ultralytics/hub/__init__.py", line 5, in <module>
from ultralytics.data.utils import HUBDatasetStats
File "/home/ec2-user/.local/lib/python3.7/site-packages/ultralytics/data/__init__.py", line 3, in <module>
from .base import BaseDataset
File "/home/ec2-user/.local/lib/python3.7/site-packages/ultralytics/data/base.py", line 12, in <module>
import cv2
File "/home/ec2-user/.local/lib/python3.7/site-packages/cv2/__init__.py", line 181, in <module>
bootstrap()
File "/home/ec2-user/.local/lib/python3.7/site-packages/cv2/__init__.py", line 153, in bootstrap
native_module = importlib.import_module("cv2")
File "/usr/lib64/python3.7/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 -i https://pypi.douban.com/simple/ opencv-python-headless