CJ. CJ. - 2 years ago 351
Python Question

How do I run python from Sublime text 3?

I just got python and sublime 3. When I press control + b, I get this in the console:

'python' is not recognized as an internal or external command,
operable program or batch file.

And it won't run my amazing code!


I do have Python installed, and how do I change the PATH?

Answer Source

If you installed Python 2, you'll need to just go ahead and install Python 3, as it's the present and future of the language. Don't starting learning Python with 2, you'll pick up all sorts of bad habits. Learn with 3, then go back and find out the differences with 2 when you can understand them. I'm assuming you're on a 64-bit system, as everything is these days, so download Python 3 from here. If you're not, get this one. Run the installer, and pick the option (I forget exactly where it is) that says "Add Python to my PATH". Finish the installation, restart Sublime, and it should pick up python.exe just fine.

BTW, in Python 3, print is a function, so your first code to run should be


Don't forget to save the file before building.

Oh yeah, avoid "Learn Python the Hard Way" like the plague. It sucks. Instead, read the official tutorial first, then pick something here and/or here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download