Nika Tvildiani Nika Tvildiani - 1 month ago 7x
Python Question

Execute python 3 not python 2

I have installed python 2 after installing python 3.And now when I executing my python file by clicking on file (not by cmd) its run python 2 ,but I want python 3.
I have tried script:

import sys
print (sys.version)

output was:


Can someone help me to make python 3 default on my pc. So when i run my file,it execute Python 3.
Sorry for bad English.


If the current default windows application for .py files is currently python2 (i.e. C:\python27\python.exe) and not the new py.exe launcher, you can just change the default windows application for the file type. Right-click on file -> properties -> click the change button for default application and change it to the python3 executable.

If the default application for the file is the py.exe windows launcher, you can add a shebang line in your scripts to force the python executable and the launcher should respect it. Add this as the first line of your file


If you're python3 installation path is different, make sure to use that instead.