0

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?

4
  • I dont see your python path at env variable... Commented May 10, 2013 at 1:48
  • [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 Commented May 10, 2013 at 1:51
  • The same error pops up again. Commented May 10, 2013 at 1:52
  • See this solution stackoverflow.com/a/13111706/403810 Commented May 10, 2013 at 2:21

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

-1

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

4 Comments

Does sublime text 2 automatically download python27 for me or do i have to do it by myself? Also, how do you delete all the paths for python on the system?
Sublime wont download anything for you so you have to download it by yourself. Yes delete all the python paths on your system and start all over. I use pyDev eclipse plugin its great for python developments I suggest you check it out.
Could you explain a little more, into your choice.. Why you think it's best etc.. As it is, this is suitable for a comment.
well i just think it makes everything easier when it comes to python. Its my personal favorite anyway

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.