https://en.wikipedia.org/wiki/Stotting
Most lions also know not to prey on humans, for similar reasons: if a lion took a human, it risks being hunted down by other humans related to their prey. Most "man-eating" lions or tigers are starving or injured, therefore desperate, and lions are largely seen in Africa as pest creatures who take livestock.
(Hippopotamuses, by contrast, give absolutely no fucks and will kill you on sight. Africans consider the hippopotamus to be the fiercest animal by far, even more so than the lion.)