Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I reinstall a directory in /usr/bin/python [closed]

I have researched this for hours to no avail.

I think I deleted my directory at /usr/bin/python when I installed python 3 because I get this error: -bash: /usr/bin/python: No such file or directory.

I've tried sudo ln -s /usr/bin/python2.7 /usr/bin/python, and that gives me ln: /usr/bin/python: File exists

However, it still doesn't permanently install a directory in /usr/bin/python. How do I permanently restore this directory?

I'm on a mac.

Thanks!

like image 434
Alex Klinghoffer Avatar asked Mar 06 '13 00:03

Alex Klinghoffer


People also ask

How do I install Python usr bin?

Install your “dev” Python into /usr/local/python-x.y.z or a similar location. Setup your shell (e.g. path variable and aliases) so that “python” and “python3” will run your preferred version. In scripts, use #!/usr/bin/python3 to run with system Python. Use #!/usr/bin/env python3 to run with your dev version.

What is Python in usr bin?

By specifying #!/usr/bin/python you specify exactly which interpreter will be used to run the script on a particular system. This is the hardcoded path to the python interpreter for that particular system. The advantage of this line is that you can use a specific python version to run your code.


1 Answers

Your file /usr/bin/python exists because you get the message:

ln: /usr/bin/python: File exists

but I see that it is a corrupted link to something that doesn't exist, because you get the message:

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

What you have to do to fix that is:

sudo rm /usr/bin/python    # because that's a corrupted file
sudo ln -s /usr/bin/python2.7 /usr/bin/python    # this line will work if your file /usr/bin/python2.7 is OK.

Hope that helps!

like image 106
sissi_luaty Avatar answered Oct 06 '22 00:10

sissi_luaty