If you are working on a Apple Mac you probably know Textmate - THE texteditor for Mac. Also if you do start Python Coding you get confronted with Python 2 and Python 3 and do know that Max OS X is using Python 3 per default. The installation of Python 3 is pretty is, if you follow the instructions on the Python Website.
A bigger approach is to set up TextMate to use Python 3 per default for their TextBundles!
A view solutions came up after my research which I want to point out - at the end its your decision which one you like most. But before you start, you have to get some path information, so open Terminal.app to find out the path for your Python interpreters
which python-> for getting python 2 path
which python3-> for getting python 3 path
which python3.1-> letting you know where to find python 3.1 installation
#!/usr/local/bin/python3.1this line at the beginning hard wires python3.1 interpreter to the file
All the above mentioned solutions are pretty easy to realize and working great, but do have one downside! You have to use the Terminal.app to execute the PY-File. That means using CMD+SHIFT+R command. As soon as you use the TextMate integrated Script Engine it will use Python Version 2 instead.
Using Python within TextMates own Script Engine You can add or modify a global PATH shell variable to TextMate -> Preferences (see above) by adding the path to your python3 interpreter.
In my case it is /usr/local/bin which creates an entry for PATH looking like /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Now you can define which enginge TextMate should use by setting the shebang to #!/usr/bin/env python3 for Python 3 and without the version number it uses the default Mac Python Bundle.
Actually my setup is combining both options to have the Terminal.app and the TextMate Script Engine running Python 3 - at the momemt I am searching for a solution to have the same approach from the the TextMate Script Engine at the Terminal.app as well. Resources