Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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!

share|improve this question

migrated from Aug 3 '12 at 1:49

This question came from our site for professional and enthusiast programmers.

What does which python say? And just to be paranoid, echo $PATH to check that /usr/bin is in the path. – Daniel Fischer Aug 1 '12 at 21:15
cd into the python directory and search for the easy_install command, /path/to/easy_install <module>. This is windows anyways, but it might be similar with mac. – user1538709 Aug 1 '12 at 21:16
Are any of the python versions actually named "python", or things like "python27" and "python32"? – arxanas Aug 1 '12 at 21:16
What's the output pf ls -l /usr/bin/python*? – ernie Aug 1 '12 at 21:22
@DanielFischer which python says /opt/local/bin/python – user1569756 Aug 1 '12 at 21:59
up vote 1 down vote accepted

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 :


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

share|improve this answer
Thank you very much for your help! Now everything is much more understandable! – user1569756 Aug 2 '12 at 11:27

Probably a missing symlink. Try:

ln -s /usr/bin/python3.2 /usr/bin/python

You might need to replace the first argument to match the name of the python executable you found in /usr/bin

share|improve this answer
python3 might be more preferable for python3.2. python should be reserve for Python 2 – J.F. Sebastian Aug 1 '12 at 21:20
Thanks for the feedback. Then the code above should be changed to symlink to a python 2.* to make the shebang work in easy_install – Wouter Aug 1 '12 at 21:22

You must log in to answer this question.