Yeah, but if pilots had guns, what would happen if they snapped and decided to shoot all the passengers?
Joking, of course.
Exactly. If the guy driving the plane wants to kill everyone, he surely doesn't need a gun to get the job done. There is no viable reason not to arm someone who is already trusted with responsibility for the safety of everyone on the plane.