You CANNOT shoot a mountain lion or bear because it 'could' put you in danger. If it's 'heading right for you' (ala South Park) you're going to have a hard time explaining to the authorities WHY you felt so sure it was going to kill you that you had to shoot it from 80 yards... at 8 yards, your story becomes more credible. I'm not saying you should intentionally let it get close before you respond... just that if they AREN'T getting that close, shooting is unnecessary... and ABSOLUTE NECESSITY is your ONLY justification.
Having said that, black bear and mountain lions are dangerous if they feel threatened; leave them alone, and it's very, very, vanishingly rare that they bother people. Humans may be 'smarter', but the animals have more sense than some people. Given the OPTION, they'll likely look at you, see a mammal small enough to take but big enough to hurt them, and decide to leave. I've had this experience here in the Hill Country... a good bit less than 50 yards, just out of the treeline at dusk, a mountain lion... we saw each other at the same time, I think we might've BOTH peed just a little... then we both backed up a bit and went home.
ETA: Take mosquito repellent... they're far more likely to eat you.