The death penalty in Norway was abolished in the General Civil Penal Code of 1902. The death penalty was kept, however, in the military penal code, also of 1902, but only for military personel, and only in times of war.
Hence, there was no legal grounds for executing Quisling before the occupation.
The Norwegain government, exiled in London, reintroduced the death penalty for civilians in 1941. In 1945 it was extended to also apply to foreign war criminals. Stortinget, the Norwegian parliament, ratified this after the end of the occupation in 1945, and hence there were legal grounds for executions.
25 Norwegians, including Quisling, and 12 Germans were executed from 1945 to 1948, for treason, murder, torture or betrayal during the occupation.
Source: Norsk krigsleksikon 1940-45, Oslo 1995.
He was an officer and a normal politician before the war. We have currently more crazy politicians active in Norway, and we don't execute them either.
No one knew that he was going to betray the country when Germany attacked - most politicians didn't even see the attack coming. Norway didn't practice preemtive executions. People have to do something wrong first, we can judge them afterwards. Not the other way around.