3

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?

ToxicGLaDOS
  • 441
  • 5
  • 16

2 Answers2

2

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
apple16
  • 1,137
  • 10
  • 13
1

Windows is unable to find your python installation. When you run a command like:

python <your_file.py>

the first python tells your system to find wherever your python binary is and try to run some command by that name. By looking over the path that was echoed, it doesn't look like you actually have your python binary on your system path.

If you're uncertain as to how to add python to your path, check out this superuser question: https://superuser.com/questions/143119/how-to-add-python-to-the-windows-path

Community
  • 1
  • 1
Slater Victoroff
  • 21,376
  • 21
  • 85
  • 144