4
votes

I stupidly downloaded python 3.2.2 and since then writing 'python' in the terminal yields 'command not found'. Also, when starting the terminal I get this:

Last login: Wed May 2 23:17:28 on ttys001 -bash: export: `folder]:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/android-sdk-mac_86/tools:/Applications/android-sdk-mac_86/platform-tools:/usr/local/git/bin:/usr/X11/bin:/usr/local/ant/bin': not a valid identifier

Why the Android SDK folder is there is beyond me. It's all jazzed up. Any ideas how can I remove the offending file, folder or fix his problem? I've checked the System Profiler and python 2.6.1 and 2.7.2.5 shows up.

3

3 Answers

1
votes

Something got messed up in your $PATH. Have a look in ~/.profile, ~/.bashrc, ~/.bash_profile, etc., and look for a line starting with export that doesn't end cleanly.

1
votes

If the binary was not overridden it's typically located in

/System/Library/Frameworks/Python.framework/Versions/X.X/bin/python

where X.X is your version (probably 2.7) if it's not located there it could be sometimes found in

/Library/Frameworks/Python.framework/Versions/X.X/bin/python

If you find the right binary and can run it, go ahead and start symlinking it where you need to and making the necessary patches. My first piece of advice would be changing your Current to point to the old version.

 sudo ln -s /System/Library/Frameworks/Python.framework/Versions/X.X /System/Library/Frameworks/Python.framework/Versions/Current

or

sudo ln -s /Library/Frameworks/Python.framework/Versions/X.X /Library/Frameworks/Python.framework/Versions/Current
1
votes

A very ugly solution to your profile problem since $PATH seems to be very wrong (as was mentioned by blahdiblah)

/bin/cp ~/.profile /tmp/bkup_profile
/bin/cat /tmp/bkup_profile | /usr/bin/grep -v "PATH" > ~/.profile

Open a new terminal and see if you can run commands normally try ls, echo, sudo for example.