I recently installed sublime text 2 to try it out before I decide to get sublime text 3 but I can't properly run any code from it. I've hit Ctrl + B and I get an output like this.
[Error 2] The system cannot find the file specified
[cmd: [u'python', u'-u', u'C:\\Users\\Jeff\\Desktop\\Personal codes\\print.py']]
[dir: C:\Users\Jeff\Desktop\Personal codes]
[path: C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files(x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;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)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Live\Shared]
[Finished]
I've looked in my roaming folder and found sublime text 2 because another post mentioned editing a file in the python folder there but no such folder exists in Roaming\Sublime Text 2 all I have is Installed Packages, Packages, Pristine Packages and Settings. Am I missing something or is it something obvious that I should know?
解决方案
Instead of adding python to the path, I prefer simply specifying the full path to python in the sublime build. Python.exe is probably installed in one of these (or something similar)
C:/Python
C:/Program Files/Python
C:/Program Files (x86)/Python
etc...
Once you found it (lets say its in C:\Program Files (x86)\Python27) edit the sublime_build for python. Here is the build I use:
{
"cmd": ["C:\\Program Files (x86)\\Python27\\python.exe","-u","$file"],
"selector": "source.python"
}
for me, this file is in
Sublime Text\Data\Packages\Python\Python.sublime-build