Reputation: 41
I am just trying to code print("Hello World")
and the Sublime Text editor is giving me the error
[WinError 2] The system cannot find the file specified [cmd: ['python3', '-u', 'C:\Users\DELL\Desktop\python_work\hello_world.py']] [dir: C:\Users\DELL\Desktop\python_work] [path: C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Windows Live\Shared;C:\Users\DELL\AppData\Local\Programs\Python\Python38\Scripts] [Finished]
Now I have created a new build by Tools>Build System>New Build System and in that I changed
{
//"shell_cmd": "make"
"cmd": ["C:\\Users\\DELL\\AppData\\Local\\Programs\\Python\\Python38", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
and saved it as file in sublime folder but it's still showing the same error.
What is going wrong and how can I build my Python code with Sublime Text?
Upvotes: 2
Views: 12307
Reputation: 10864
The problem is that Sublime by default tries to run Python scripts with the "py" command in a console. However that only works if a Python launcher is installed, but that doesn't have to be the case on Windows. It's the same problem as in How to edit Sublime Text build settings? and either requires you to add a custom build setting or edit the Sublime build settings for Python and replace "py" with "python" for example.
Upvotes: 0
Reputation: 51
I would recommend this:
Upvotes: 1
Reputation: 1
WinError 2] The system cannot find the file specified [cmd: ['H:/python/py3.7.9/python.exe', '-u', 'C:\Users\Ashwin Kumar\AppData\Roaming\Sublime Text 3\Packages/Kivy Language/preview/kv.preview.py', 'H:\python\development\kivy_venv\Lib\site-packages\ftapp.py', 'H:\python\development\kivy_venv\first_app']] [dir: H:\python\development\kivy_venv\Lib\site-packages] [path: C:\Program Files (x86)\Common Files\Oracle\Java\javapath;F:\oracle\product\10.2.0\db_1\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Lenovo\FusionEngine;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\Windows Fabric\bin\Fabric\Fabric.Code;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\dotnet;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\py3.7.9;C:\py3.7.9\Scripts;C:\py3.7.9\Lib\site-packages;C:\py3.7.9\Lib\site-packages\kivy;C:\python_3.8\Scripts;C:\python_3.8;C:\Users\Ashwin Kumar\AppData\Local\Microsoft\WindowsApps;C:\Users\Ashwin Kumar\AppData\Local\atom\bin;H:\2020\py_learning\PyCharm Community Edition 2019.3.1\bin;;C:\Users\Ashwin Kumar\AppData\Local\Microsoft\WindowsApps;] [Finished]
if you get above kind of problem,just check using below steps.
for dependency package installation use below link.
https://kivy.org/doc/stable/installation/installation-windows.html#alternate-win
{ "cmd": ["python.exe", "-u", "$packages/Kivy Language/preview/kv.preview.py", "$file", "$folder"], "file_regex": "^[ ]File "(...?)", line ([0-9]*)", "selector": "source.kv", }
6.run the code (ctrl+B)
Edits are welcome!.
Upvotes: -2
Reputation: 182
Make sure to check that the file is located exactly where the program thinks it is and that the filename is the same.
"[WinError 2] The system cannot find the file specified" might help.
Upvotes: 1