Search code examples
pythonpython-3.xpython-3.6

How to fix "Can't find a default Python" error


I am using python in a windows server(64 bit) and it is installed by another user in his own directory in C:\user\userx\AppData\Local\Programs\Python\Python36

All other users (excluding me) are able to run Python files on this server. I get the following error when I run a Python program:

C:\Users\user x\AppData\Local\Programs\Python\Python36>test.py
launcher build: 32bit
launcher executable: Console
File 'C:\Users\my user\AppData\Local\py.ini' non-existent
File 'C:\Windows\py.ini' non-existent
Called with command line: "C:\Users\user x\AppData\Local\Programs\Python\Python
36\test.py"
maybe_handle_shebang: read 12 bytes
maybe_handle_shebang: BOM not found, using UTF-8
locating Pythons in 64bit registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: unable to open PythonCore key in HKLM
locating Pythons in native registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: unable to open PythonCore key in HKLM
found no configured value for 'python'
search for default Python found no interpreter
Can't find a default Python.

I tried running my code in the command line with set pylaunch_debug=1 and it showed below errors.


Solution

  • I found the solution:

    setting global variable in cmd as below resolved the issue

    C:> ftype Python="C:\Users\user x\AppData\Local\Programs\Python\Python36\python.exe %1 %*"