0
votes

I downloaded sublime text 2 and I have a problem running a code with the language python. Here is my code:

def main:
    print "Hello"
main()

I get an error when I do ctrl + B:

[Error 2] The system cannot find the file specified

[cmd: [u'python', u'-u', u'C:\Users\Hari\Documents\test.py']]

[dir: C:\Users\Hari\Documents]

[path: C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon] [Finished]

I am using Windows 8 and I tried to change the environment variables by adding C:\Python27\; or C:\Python26\; or C:\Python33\; or C:\Python2\; or C:\Python2\; to the beginning of the path but it still gives me the same error. Can someone help me?

3
I dont see your python path at env variable... - papachan
[Error 2] The system cannot find the file specified [cmd: [u'python', u'-u', u'C:\\Users\\Hari\\Documents\\test.py']] [dir: C:\Users\Hari\Documents] [path: C:\Python27\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows - asdf
The same error pops up again. - asdf

3 Answers

2
votes

You need to edit %APPDATA%\Sublime Text 2\Python\Python.sublime-build

Modify (change) content to:

{
    "cmd": ["C:\\Python27\\python.exe", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

So, change the "C:\Python27\" path part to any path/version of Python that exists in your system.

0
votes

The easiest way to make sure that changes to environment variables are applied is to reboot Windows.

And if Sublime Text 2 is started from some Python script using subprocess module, then it starts to behave strangely.

-1
votes

delete all the paths for python on your system...and try to install python again,I recommend python27. in the environments add c:/python27.