Bees are pretty sensitive to movements, so if you see some mosying around, then try to move slowly and smoothly and they should ignore you.  Swatting at them or waving them away will likely send them into Alarm mode.

Bee's won't usually sting you out of pure spite.  The chances are that you accidentally hurt it or gave it cause for concern without even knowing.  This could be stepping on it, or holding it in a fold in your clothing, or just batting it away.

Once bees release the ["Alarm" pheromone](https://www.perfectbee.com/learn-about-bees/the-science-of-bees/how-bees-use-pheromones/), all you can really do is vacate the immediate area.

> **Alarm**

> The complexity of pheromones in bees is illustrated well by the two types of alarm pheromone, which can be distinguished by which glands release the pheromone.

> - From the Koschevnikov gland: This gland is near the sting shaft and is released when a bee stings. The release of the alarm pheromone is a defensive reaction to alert nearby bees. This alarm pheromone smells like bananas. If you are unfortunate enough to be stung, you may wish to leave the area as you tend to the sting, because alarm pheromones are being received by other bees.

> - From the Mandibular glands: This consists of 2-heptanone and is used as an anaesthetic and to paralyze intruders, after which bees remove the intruder from the hive.

Note here the pheromone that's most likely to relate to you smells like bananas, so if you're eating one, it's a good idea to drop/dispose it.