MacOS – “Cannot execute binary file” with alias of binary

binarymacospython

I have installed both python3.3 and python2.6.
I have set python3.3 to default by creating an alias named "python" in usr/bin and another one for python2.6 named "python2.6".
Now if I type in the terminal "python" python3.3 will be open but if I type "python2.6" I get "cannot execute binary file".
I can launch the binary directly but not through the alias.
I have checked the permissions and are the same for both binaries and aliases so I don't know what to do.
Can someone help me?

Best Answer

Instead of using Finder aliases, use Terminal to create symbolic links (see man ln for details on usage):

ln -s /path/to/python3.3/binary /usr/local/bin/python
ln -s /path/to/python2.6/binary /usr/local/bin/python2.6

It's usually not a good idea to mess with /usr/bin content (will be wiped out with the next upgrade). Use /usr/local/bin instead and make sure it comes before /usr/bin in $PATH.