I am using ubuntu 20.04 to write python programs. I usually install python packages without the
sudo prefix. But I noticed that if I go into the sudo mode and then try to import a previously installed python package, it would raise
ModuleNotFoundError: No module named 'xxx'. But if I exit the sudo mode everything will be alright again.
What could be the reason? Could it be because in sudo mode the import path is not added to the
PATH variable? But that doesn't seem to be the reason if you check my
PATH variables below:
Normal user mode: