Why don't combat aircraft have rear-facing weapons? This excellent question addresses the role of dogfighting in modern aerial warfare. However it seems that most ACM concentrate on maneuvering into shooting position. Why don't combat aircraft have rear-facing weaponry?

Even WW-II bombers had rear-, side-, and downward cannons, albeit manned. Could a small electronically-controlled cannon be added to the stern dorsal part of a combat aircraft, for shooting rearward? I've personally seen remote-operated FN MAGS on vehicles, the whole system seems to weigh on the order of 100-150 KG including hundreds of rounds. The vehicle-mounted systems took up about a cubic meter or so of space, but a purposed-designed system could probably take up less than half that, and probably shave off a good portion of the weight as well.

Could a computer not point a barrel at a vehicle with a relative velocity approaching 0 and shoot, even in a +Mach 1 wind in the direction of the target? It may be enough to just get a few bullets in, shotgun style. The Uzi rifles famously don't shoot straight, they make a cone of bullets. Perhaps this cone, if aimed in the general direction of an aggressive aircraft, might be enough to either disable it or get it off your tail. A short barrel will make a wider cone, perhaps the rear-facing weapon could have an very short barrel. ACMs such as the Cobra maneuver seem to imply that there are a finite number of angles from which attack is most likely, the weapon could be limited in angular range to those angles. 

I'm sure that piloting an aircraft while trying to avoid being shot is difficult enough, so I wouldn't assume that such a system would be of much help on a single-seat aircraft. However, in a dogfight presumably the ROI or navigator could operate the guns while the pilot does the aviation.
If your opponent is directly behind you, you have lost the fight. The point of basic fighter maneuvering, or BFM, is to keep your opponent off your tail and hopefully get on his. Everything you would learn as a fighter pilot centers around ensuring you would never have to use a rear-firing weapon.

In addition, visibility directly behind the pilot is typically poor; humans can't turn our heads 180 degrees, and if we could we'd be staring at the headrest behind us. A few fighters have had rear-view mirrors, typically ones with a two-piece canopy including the Eurofighter, F-15C and F-14 among others, but the one-piece bubble canopy on fighters like the F-16 and F-22 give no good place to put a mirror that wouldn't further interfere with the pilot's forward vision. Rear-view cameras would be laughed at by pilots as a waste of an MFD.

A cannon firing backward would also be a pretty single-purpose weapon; in a multirole fighter you might get a chance to use it to add insult to injury when pulling out of a ground run, but in all likelihood you'll either have peeled off to one side as soon as you pickled your bombs, or you'll be toss-bombing and not even overfly the target. The only real reason you'd ever fire it would be to keep someone directly behind you on their toes.