Is it possible, in Electrum, to convert a p2pkh wallet to a p2wpkh one, so I can use the Lightning network?
You could theoretically export the wallet to a new type by seed (p2pkh to p2wpkh) but it would not recognize any utxo that came into it as the derivation for p2pkh and p2wpkh are different. It's not like with some altcoins who created new "address standards" that are just different way of hashing public keys, in bitcoin p2pkh and p2wpkh are different scripts.
There are wallets out there that allow for multiple types of scripts to be used, but I believe in electrum (desktop) the only way is to create a new wallet with a p2wpkh script type and transfer your funds there. I would still advise to do it (being security-conscious) as of now it will allow you to save on transaction fees as p2wpkh transactions are cheaper.
Also in the comment of One seed phrase created two wallets with two script types @prayank has mentioned there is possibly a workaround to electrum having only one type of script available in the single wallet, but he hasn't gone into the details.