I have Python 3.14.2 installed on my Windows 11 system. Visual Studio opens and runs Python scripts fine, but whenever I try to open any .py file directly by double-clicking it, the window immediately closes. I’ve tried:
-
Reinstalling Python
-
Setting
.pyfile associations withpython.exe -
Running
assocandftypecommands in CMD -
Adding
input()at the end of the scripts -
Creating
.batscripts
Nothing seems to work. The scripts only run properly inside Visual Studio or another IDE.
Could you please help me fix this so that I can run Python scripts directly by double-clicking .py files on Windows?