Most of the time when this problem occurs, people will read answers directing them into the windows registry, often unnecessarily.
In the majority of cases, the registry key
HKEY_CLASSES_ROOTPython.FileshellEdit with IDLEcommand
will already exist and have the correct value, but it will only be used by Windows shell context menu if .py files are set by default to open with python.exe.
This is the first thing to check, and solves the problem in the majority of cases:
- right click on a .py file
- open with...
- choose default program...
- tick always use the selected program to open this kind of file
- choose python.exe
This runs the script in a terminal, but also sets the filetype back to python.
Now check the right click menu again.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…