To fix a python error such as “ModuleNotFoundError: No module named ‘tweepy'”, you should check your version of python with:
python3 --version
Often you will have one version installed but trying to execute the script with another version where the module is not installed.
Check your python version in your path with:
echo $PATH
For me, my path specific v3.11.2 but I was running the script with 3.10.1.
Update your .bash_profile file with the correct version, then run:
. ~/.bash_profile
to update the file. Re-test your python version with the command above. Then reinstall the module and test again. It should work.