I used Sublime Text 3 before and everything worked well. After updating it to Sublime Text 4, I found it cannot run python scripts anymore.
By clicking Ctrl+B in a python script, I get this output every time:
[WinError 2] The system cannot find the file specified.
[cmd: ['py', '-u', 'C:\\Users\\Hsin\\Desktop\\tkinter-test.py']]
[dir: C:\Users\Hsin\Desktop]
[path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp;D:\Software\NetSarang\Xshell 6\;D:\Software\NetSarang\Xftp 6\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Software\Git\cmd;D:\Software\MATLAB\R2019b\bin;D:\Software\Adams\Adams_Student_Edition\2020\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\Software\Miniconda3;D:\Software\Miniconda3\Library\mingw-w64\bin;D:\Software\Miniconda3\Library\usr\bin;D:\Software\Miniconda3\Library\bin;D:\Software\Miniconda3\Scripts;C:\Users\Hsin\AppData\Local\Microsoft\WindowsApps;D:\Libraries\ffmpeg\bin;C:\Users\Hsin\AppData\Local\GitHubDesktop\bin;;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps]
[Finished]
I notice the command actually sends ‘py’ instead of ‘python’, which makes it cracked down. In the default configuration file Python.sublime-package
, I confirmed this issue:
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "utf-8"},
"windows": {
"cmd": ["py", "-u", "$file"],
},
"variants":
[
{
"name": "Syntax Check",
"cmd": ["python3", "-m", "py_compile", "$file"],
"windows": {
"cmd": ["py", "-m", "py_compile", "$file"],
}
}
]
}
Now that I do use Windows operating system, so the software chooses a ‘py’ and leads to a cracking down.
I am confused why in this situation a ‘py’ is added along with ‘python’. I checked Sublime Text 3, and there was no such distinction, only a ‘python’ there. Is this a bug for windows users?