How to fix Cant find a default Python error

How to fix Cant find a default Python error

Associate the correct file group with .py scripts:

assoc .py=Python.File

Redirect all Python files to the new executable:

ftype Python.File=C:Pathtopythonw.exe %1 %*

Cant find a default Python is not from windows itself, but from the python launcher.

Resetting ftype (as in some other responses) directly to a specific python install should mask the error, but is bypassing the Python Launcher. The alternative is to fix actual problem. Perhaps more complex than simply making it go away, but masking it means a key feature, python launcher, has then been disabled.

If you have this error, check ftype by entering

 ftype Python.File

without setting a new value.

The normal value should be Python.File=C:windowspy.exe %L %*

Py.exe is the Python launcher. This launcher inspects python files and for the shebang line at the top of the file specifying which version of python will be used.

Py.exe is the program reporting cannot find a default python. Resetting the ftype to directly load python will bypass the error, but will disables the intermediate step of py.exe which should select the correct python version for the file. If you a fine disabling py.exe, that is ok, but if you wish to fix py.exe, then try setting the environment variable PYLAUNCH_DEBUG like this (as the original poster had done):


Then trying again (or just enter py as a command) for more info on exactly what is failing.

For me the registry entry for


was missing and adding that key fixed the problem. You can edit the registry keys and set the one above for the relevant python version with required path, or add a py.ini file. Instruction for the py.ini are a little long for here, but i will add a link if anyone wants.

There are two problems with bypassing python launcher. Firstly the problem could return if a new version is added, and secondly the ability for programs to specify the correct python version is disabled.

How to fix Cant find a default Python error

I found the solution:

setting global variable in cmd as below resolved the issue

C:> ftype Python=C:Usersuser xAppDataLocalProgramsPythonPython36python.exe %1 %*

Leave a Reply

Your email address will not be published. Required fields are marked *