Paris police said the attacker shouted “Allahu akbar”, the agency added.
He is understood to have been shot in the legs after trying to attack the soldier in the Carrousel du Louvre area of the museum. Media reports said he had been seriously injured.
France’s interior ministry said on Twitter that a serious security incident was under way at the popular attraction, which has been cordoned off.
The soldier was part of Operation Sentinelle, the massive deployment of French military on the streets after the Paris terror attacks in November 2015.
Europe 1 radio station reported that bomb disposal officers were at the scene