The python version that is used by Textmate when you use Command-R to run a python program may be different from the version that is used when you run the program from the command line. This post explains how to make Textmate use the latter python version, if you prefer to do so.
- Go the terminal and at the prompt, type which python and press Enter.
- Copy the path that you get as a result.
- Go to Textmate and go to Preferences → Advanced → Shell variables.
- See if a variable TM_PYTHON is listed here. If so, change its value to the value you copied in Step 2. If not, press + to add a variable. Type TM_PYTHON for variable name and the copied path for Value.