[Python] ImportError: cannot import name 'YOLO' from 'ultralytics' (unknown location)

Discussão em 'Python' iniciado por Stack, Março 25, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to build a YOLOv8 model, and I have built it using cloning github repo of YOLOv8. https://github.com/ultralytics/ultralytics

    For training the yolov8 docs say that I need to start as follows

    from ultralytics import YOLO


    But when I try to do the same after using pip install ultralytics, I get this error:

    ImportError Traceback (most recent call last)

    /tmp/ipykernel_28/546599741.py in <module>
    ----> 1 from ultralytics import YOLO
    2
    3 # Load a model
    4 model = YOLO('yolov8n.yaml') # build a new model from YAML
    5 model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training)

    ImportError: cannot import name 'YOLO' from 'ultralytics' (unknown location)

    Continue reading...

Compartilhe esta Página