In the case of the US, development of aircraft armament was minimal during the inter-war years. As a result, the US really had no well developed, reliable aircraft cannon at the start of WWII - the M2 .50 machine gun was first developed during WWI, and as such was available and reliable, and was the heaviest weaponry commonly deployed on US fighter aircraft prior to WWII (the .30 MG was also pretty common). The US Army and Navy both desired to transition to cannon armament as soon as possible, however.
The US licensed and built the Hispano 20mm cannon as the M1, but the weapon was unreliable, with misfires due to light strikes from the firing pin being common. With wing mounted armament, the guns were normally cocked on the ground before flight with no method of cocking or cycling the weapon if a misfire or jam occurred. The P-38 was able to use the cannon, because the nose mounted position allowed room for equipment to re-cock the gun in the event of a misfire. Up through the end of the war, the US was unable to produce a 20mm cannon that was reliable enough to deploy as a standard armament in aircraft with wing-mounted guns. This trend had continued even though the design had been modified into the M2 and later M3 in attempts to increase its reliability.
Mike