President Trump has pulled out of the Paris climate accord, and Mayor de Blasio is sad.

“This decision is an immoral assault on . . . everyone on this planet,” de Blasio said Thursday. But how can the mayor expect other people to change their behavior drastically when he won’t change his in the simplest of ways?

The Paris accord, agreed to under President Barack Obama, was the strange byproduct of two impossible goals: We want people to use less carbon, but we don’t want to inconvenience our consumers (read: voters). So the agreement allowed China, for example, to continue increasing its carbon emissions until 2030, to avoid disrupting the global economy that sends cheap goods to the West.

Trump’s critics argue that China’s carbon emissions may have already peaked. Perhaps — although the leveling-off may point to an economic-growth slump.

Either way, this possibility doesn’t bolster the idea that we can painlessly achieve a reduction in carbon emissions through a global agreement. If China is cutting emissions, it’s not because Beijing cares about the planet, but because Chinese people are getting fed up with breathing in coal dust.

As China tightens up environmental regulations — and as people around the world can afford things like air conditioning even as they’re still without reliable clean water — energy prices will rise.

Long-term, this is already happening. (Fracking in the First World is a short-term effect of high oil prices, not a long-term cause of lower ones.)

But we oughtn’t deny the basic economics. People will use less carbon — eventually — not because they’re nice, but because it will be more expensive. The world’s governments could achieve this effect more quickly through a carbon tax.

Why not get it over with now? Because it’s too hard, politically and practically, to change people’s behavior by making them pay the full purported cost of carbon — that is, asking you to pay for next decade’s hurricane with your gas purchase today.

This is obvious if you look at de Blasio’s own behavior. The mayor loves one job perk: his cop-driven caravan of SUVs. De Blasio regularly travels the 12 miles from Gracie Mansion on the Upper East Side to Brooklyn’s Park Slope, so that he can go to the gym. (To say nothing of his shameless use of an NYPD helicopter to save time.)

On Friday, transportation economist Charles Komanoff rang up Brian Lehrer’s radio show to call the mayor out on this flagrant waste of carbon. “I’m not going to take the bait, my friend,” de Blasio answered. “Whether I go to the gym does not affect the policies that affect millions of people . . . I’m proud to say we have a hybrid, and it’s a good car, it’s very fuel efficient . . . The issue is not cheap symbolism.”

But this isn’t cheap symbolism. It’s that the mayor wants to live his life the way he wants to live his life, even if it means wasting carbon (and taxpayer money).

On that front: Passenger cars accounted for 12.4 million tons of carbon emissions in New York City in 2015, the last year for which data are available. That’s more than any other source, and made up nearly a quarter of the city’s total emissions. (New York doesn’t count the carbon emissions from the airplanes that bring the world’s businesspeople and tourists to us, presumably because it would make our carbon footprint look worse.)

The mayor bristles at anyone who brings up these inconvenient truths. His spokesperson dismissed the idea of the mayor cycling to work by saying that “the mayor of New York City can’t be using a bike as a main mode of transport.” This is hardly self-evident: Boris Johnson cycled to work as London’s mayor.

Other people want to get around as they please, too, and they’ll do so until higher prices cause them to change. You can bet the mayor wouldn’t take a fleet of SUVs to the gym if he had to pay for the vehicles, the gas and the drivers (because, as he likes to tell you, he is not a billionaire).

When the mayor is brave enough to suggest congestion pricing — or can restrain himself from handing out tens of thousands of free parking placards to union workers — he can lament Trump’s decision.

Nicole Gelinas is a contributing editor to the Manhattan Institute’s City Journal.