4

I accidentally typed:

sudo ln -sf /usr/local/bin/python2.5/ /usr/bin/python 

instead of:

sudo ln -sf /usr/local/bin/python2.5 /usr/bin/python

Now bash tells me that /usr/bin/python is not a directory whenever I run python.

ls -l /usr/bin/python gives me expectedly /usr/bin/python --> /usr/local/bin/python2.5/

Is there any safe way to remove that symbolic link to a directory (that does not exist) and replace it with a link to the intended file?

Arigato in advance if you have any ideas.

I am stuck....

Asad Rasheed
  • 518
  • 5
  • 13
uploada
  • 39
  • 1
  • 2
  • 4

3 Answers3

7

you can simply remove the link with rm :

rm /usr/bin/python
krtek
  • 26,334
  • 5
  • 56
  • 84
1

You remove a symlink the same way you remove a regular file, even if it's a symlink to a directory. (If the target doesn't exist, it's a moot point whether it was intended to be a directory or a file.)

Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365
0

this worked for me. Although I originally created the symlink following a blender tutorial http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux/Troubleshooting#Setting_Python_Path_in_SCons

using this command:

sudo update-alternatives --install /usr/bin/python python /your/path/to/python3.2 1

(see man page for update-alternatives for info. Terminal>man update-alternatives)

I'm curious to know how badly I've messed things up for the update-alternatives system of managing different versions of same-named software. For instance, i think scons runs on python2.7 while blender builds internally with python3.2. Will things resolve correctly still? We shall see...

animuson
  • 53,861
  • 28
  • 137
  • 147
kesten
  • 1