1

I want to set up a complete Python IDE in Sublime Text 2. I found the following threads on Stack Overflow that looked helpful:

How do I run Python code from Sublime Text 2?

Running python in Sublime Text 2 getting error

The Problem

But I followed those steps and still it didn't work for me. I called my file Test2 and saved it to my Downloads folder. I then entered a simple line of code

print 'test'

and that returned this error

[Error 2] The system cannot find the file specified
[cmd:  [u'python', u'-u', u'C:\\Users\\Stan Shunpike\\Downloads\\Test2.py']]
[dir:  C:\Users\Stan Shunpike\Downloads]
[path: C:\ProgramData\Oracle\Java\javapath;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\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 (x86)\nodejs\;C:\Program Files (x86)\Elm Platform\0.14\bin;C:\Users\Stan Shunpike\AppData\Roaming\npm]
[Finished]

Question

Why isn't this working and what steps can I take to fix this so I can code using python?

Remark:

These threads look related, but they don't discuss my problem specifically:

Sublime Text 2 Ant Build Target: [Error 2] The system cannot find the file specified

Can't resolve WindowsError: [Error 2] The system cannot find the file specified

Remark:

This thread looked useful

How to run code in Sublime text 2 python

But I didn't know what it meant to edit the "sublime build", particularly as I have yet to successfully write any code in Sublime and it looked to me like the thread was asking me to enter code to be executed.

EDIT 1:

I had already modified the Environmental Variable path, BUT I had not restarted Sublime. So at MattDMo suggested I did this. When I restarted it, I got the following error instead:

  File "C:\Users\Stan Shunpike\Downloads\Test2.py", line 1
    print "test"
               ^
SyntaxError: invalid syntax
[Finished in 0.1s with exit code 1]
Community
  • 1
  • 1
Stan Shunpike
  • 2,165
  • 3
  • 20
  • 32

1 Answers1

6

You don't have the path to your Python executable in your PATH, so Sublime can't find python. Add C:\Python27 (if that is where Python is installed) to your PATH environment variable, then restart Sublime and try again.

MattDMo
  • 100,794
  • 21
  • 241
  • 231