Python /usr/bin command not found

easy-installpython

System: Mountain Lion 10.8.

I tried to uninstall python 2.7 and therefore i also deleted /usr/bin/python.
However, after that i needed python again and i installed in again.
Now I want to use easy_install to install matlibplot etc..
Unfortunately, it says:

-bash: /usr/bin/easy_install: /usr/bin/python: bad interpreter: No such file or directory

and also /usr/bin/python:

-bash: /usr/bin/python: No such file or directory

however if i go to /usr/bin/ there are all version of python.

I also took a look to /usr/bin/easy_install; the first line says:

#!/usr/bin/python   

BTW: i also installed python 3.2 and it also not "visible" outside /usr/bin

Do I need to fix any path variables?

Thanks for your help!

Best Answer

As you mentioned in the comment, ls -l /usb/bin/python* shows:

 lrwxr-xr-x 1 root wheel 75 28 Jul 16:27 /usr/bin/python2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5 
 lrwxr-xr-x 1 root wheel 82 28 Jul 16:27 /usr/bin/python2.5-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-conf??ig 
 lrwxr-xr-x 1 root wheel 75 28 Jul 16:27 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 
 lrwxr-xr-x 1 root wheel 82 28 Jul 16:27 /usr/bin/python2.6-config

Note that there is no /usr/bin/python.

As @Wouter mentioned, you'll want to create a symlink:

ln -s /usr/bin/python2.6 /usr/bin/python

That'll create a symlink (think of it as a shortcut in Windows), from /usr/bin/python to /usr/bin/python2.6

For a bit more detail, you mention the first line of /usr/bin/easy_install is :

#!/usr/bin/python   

This is commonly known as the shebang line, and tells the script which interpretor to use - in this case it's trying to use /usr/bin/python, which, as we've seen from the ls command, does not exist, which is why we create a symlink

Related Question