1

I'm trying to install a python module, and I realized that my python command seems to be broken:

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

I've been told it could be problematic for the OS aswell (I already noticed the software center is just not working). How can I fix it and link it to Python 3.2?
I'm running Ubuntu 12.04.
Thanks!

8
  • Err how it can be broken, if it's missing? Maybe you lost your PATH? Commented Jun 27, 2014 at 12:09
  • Did you checked your unbuntu package manager (e.g. synaptic) python is installed? Commented Jun 27, 2014 at 12:10
  • 1
    And if your software center is broken, I recommend to fix that problem first. Commented Jun 27, 2014 at 12:12
  • @luk32 Then maybe it's missing. How can I find out? Commented Jun 27, 2014 at 12:14
  • 4
    This question appears to be off-topic because it is not about programming but a broken system / system administration. It should be moved to Ask Ubuntu. Commented Jun 27, 2014 at 12:21

1 Answer 1

1

You probably have a broken link.

You can check as below:

find /usr/bin -maxdepth 1 | grep python | xargs ls -l
-rwxr-xr-x 1 root root   30284 Jun 18  2013 /usr/bin/dh_python2
lrwxrwxrwx 1 root root       9 May  8 16:43 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root       9 May  8 16:43 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 2993744 Feb 27 20:24 /usr/bin/python2.7

As you can see my /usr/bin/python points to /usr/bin/python2.7 which does exist.

If your /usr/bin/python is broken and you have /usr/bin/python3.2, do the following:

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

This will delete the symlink and create a new one pointing to the right place.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much for your answer! It worked almost perfectly: it initially said 'permission denied' so I had to use sudo.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.