This might occur if you have multiple versions of python installed with different paths. You can check this by opening an idle and using:
import sys
sys.version
sys.path
This will print out the versions you have installed. You'll also need to run the above code in Command Prompt just use python first to run terminal in python.
python
import sys
sys.version
sys.path
After running on both locations, see if the version and paths are the same. If you do have multiple versions installed you can just delete the one you don't need or delete all of them and do a complete reinstall.
To find the location where python is saved follow the path you were given above and type it in File Explorer if you want to manually delete it. Mine for example is 'C:\Users\Justin\AppData\Roaming\Python\Python39'.
If you have two versions and don't want to delete either one you'll have to change paths in the idle for example:
import os
os.chdir('path you want to use')
Hope this works for you.