terminal - How to restore python on OS X Yosemite after I've deleted something? -



terminal - How to restore python on OS X Yosemite after I've deleted something? -

i think installed python through homebrew. not thought did:

$ python /library/frameworks/python.framework/versions/2.7/bin/python $ sudo rm -r /library/frameworks/python.framework/versions/2.7/bin/python

.. , terminal told me...

$ python /usr/local/bin/python

but when run python again

$ python -bash: /library/frameworks/python.framework/versions/2.7/bin/python: no such file or directory

so did this:

export path=/usr/local/bin:/usr/local/sbin:$path

now python run on terminal wondering if improve set deleted it, , how "restore" python before messed it?

thanks!

you've got multitude of problems here.

let's start off this:

/library/frameworks/python/2.7 neither apple python nor homebrew python. apparently installed third python, maybe 1 official python.org binary installers. removing 1 won't impact homebrew one.

/usr/local/bin/python not apple python either. may symlink 3rd python or homebrew python, it's not apple.

here's each python goes:

apple's python in /system/library/frameworks/python/2.7. includes various wrapper executables in /usr/bin, including /usr/bin/python, point @ /system framework. stuff install python (e.g., via easy_install or pip) includes executables or scripts go /usr/local/bin, not /usr/bin, apple's pre-installed stuff never does.

most third-party binary installers install /library/frameworks/python/2.7. different versions can optionally add together framework's bin directory path, or symlink binaries /usr/local/bin.

homebrew installs somewhere /usr/local/cellar/python/2.7.8, symlinks various executables , scripts /usr/local/bin.

so, fact you're trying apple python making sure /usr/local/bin on path heading in wrong direction.

meanwhile, never manually delete installed homebrew unless brew doctor tells to. utilize brew uninstall python—or, if want move out of way temporarily, alternative of restoring later, brew unlink python.

finally, after changing path, shell may have cached best location find python, either read on hash command or, if don't want larn more bash, create sure open new shell (e.g., opening new tab in terminal.app).

anyway, how were?

you need cleanly uninstall both pythons. explained how homebrew 1 above. 3rd one, you've done of it, there apparently things left behind in /usr/local/bin. if they're dangling symlinks, seems likely, can find them pretty with, e.g., ls -l /usr/local/bin |grep /library/frameworks/python.framework |grep -v /system.

having done that, fire new shell, , which python should tell /usr/bin/python, , happy again.

python terminal

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -