-2

This is what my python build looks like:

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

I've read that I need to change what's in the "python" part of "cmd":, but I can't find what to change it to. I've seen one video where a guy made it look really easy by taking the path from the terminal. Others say to add a "path": blah blah blah. It always seems to be for Windows computers.

I've tried so many things and I really don't know what to change to make sublime text 2 to run python. Also does it make a difference if I'm using a mac vs windows?

cellcortex
  • 3,166
  • 1
  • 24
  • 34
  • @DarrickHerwehe that comment was made before the OP edited the question and title to indicate he wanted to run Py3. – MattDMo Nov 22 '15 at 17:26

1 Answers1

0

cmd needs to be changed to the path of the python 3 executable. By default, the installer places it in ~/Library/Frameworks/Python.framework/Versions/3.4/bin/python3. So, if your mac username is Anthony, you will need to change your build like so:

{  
    "cmd": ["/Users/Anthony/Library/Frameworks/Python.framework/Versions/3.4/bin/python3", "-u", "$file"],  
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",  
    "selector": "source.python"    
}

Note: When running python 3 from the terminal, you are able to use the shortcut command python3. This is because an ALIAS was set up in your .bash_profile when python was installed. However, Sublime Text doesn't read your .bash_profile, so you must specify the full path to python.

Darrick Herwehe
  • 3,553
  • 1
  • 21
  • 30