python / usr / bin Befehl nicht gefunden

13447

System: Berglöwe 10.8.

Ich habe versucht, Python 2.7 zu deinstallieren. Deshalb habe ich auch / usr / bin / python gelöscht. Danach brauchte ich wieder Python und ich installierte wieder. Jetzt möchte ich mit easy_install matlibplot etc installieren. Leider heißt es:

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

und auch / usr / bin / python:

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

Wenn ich jedoch nach / usr / bin / gehe, gibt es alle Versionen von Python.

Ich habe auch nach / usr / bin / easy_install gesucht; Die erste Zeile sagt:

#!/usr/bin/python 

Übrigens: Ich habe auch Python 3.2 installiert und es ist auch außerhalb von / usr / bin nicht "sichtbar"

Muss ich Pfadvariablen korrigieren?

Danke für Ihre Hilfe!

2
Was sagt "welcher Python"? Um nur paranoid zu sein, müssen Sie mit "echo $ PATH" überprüfen, ob sich "/ usr / bin" im Pfad befindet. vor 11 Jahren 1
cd in das Python-Verzeichnis und suchen Sie nach dem Befehl easy_install / path / to / easy_install . Dies ist sowieso Windows, aber mit Mac könnte es ähnlich sein. vor 11 Jahren 0
Ist eine der Python-Versionen eigentlich "Python" oder Dinge wie "Python27" und "Python32"? arxanas vor 11 Jahren 0
Was ist die Ausgabe von pf ls -l / usr / bin / python *? ernie vor 11 Jahren 0
@DanielFischer welcher Python sagt / opt / local / bin / python vor 11 Jahren 0
@ernie ls -l sagt nur lrwxr-xr-x 1 Wurzelrad 75 28 Jul 16:27 /usr/bin/python2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5 /bin/python2.5 lrwxr-xr-x 1 Wurzelrad 82 28 Jul 16:27 /usr/bin/python2.5-config -> ../../System/Library/Frameworks/Python.framework/Versions/ 2.5 / bin / python2.5-config lrwxr-xr-x 1 wurzelrad 75 28 Jul 16:27 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions /2.6/bin/python2.6 lrwxr-xr-x 1 wurzelrad 82 28 Jul 16:27 /usr/bin/python2.6-config -> vor 11 Jahren 0
Okay, das erklärt, warum es nicht in `/ usr / bin` gefunden wird. Machen Sie einen Symlink. vor 11 Jahren 0
@ernie und außerdem ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config, aber in / usr / bin / kann ich Folgendes sehen: python python2.5 python2.7 -config python3.2-config pythonw2-32 pythonw3-32 python-32 python2.5-config python3.2m pythonw2.5 pythonw3.2 python-config python2.6 python3-32 python3.2m-config pythonw2.6 pythonw2.6. 2-32 python2 python2.6-config python3-config pythonw pythonw2.7 python2-32 python2.7 pythonw2 pythonw-32 pythonw2.7-32 python2-config python2.7-32 pythonw2 pythonw3 vor 11 Jahren 0
@DanielFischer ein Symlink wie: ln -s /opt/local/bin/python2.7 / usr / bin / python? vor 11 Jahren 0
Wenn dies auf "/ opt / local / bin / python" hinweist, ist das in Ordnung. vor 11 Jahren 0
Vielen Dank für Ihre Hilfe! Jetzt ist alles viel verständlicher! vor 11 Jahren 0

2 Antworten auf die Frage

1

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

Python3 ist für Python3.2 vorzuziehen. "Python" sollte für Python 2 reserviert sein jfs vor 11 Jahren 1
Danke für die Rückmeldung. Dann sollte der obige Code in symlink zu einem Python 2 geändert werden. *, Damit der Shebang in easy_install funktioniert vor 11 Jahren 0
1
ernie

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

Vielen Dank für Ihre Hilfe! Jetzt ist alles viel verständlicher! vor 11 Jahren 0