简体   繁体   中英

How do I re-install python on the mac, but version 3.2 (latest) and have all the command line stuff work

I uninstalled python using the following commands:

sudo rm -rf /Library/Frameworks/Python.framework

sudo rm -rf /Applications/Python *

then deleted all python related things in here:

 /usr/local/bin

And I just installed python 3.2, but the terminal python doesn't work, $> python doesn't do anything, other than say command not found

I uninstalled all the python stuff, because, there was a problem with the older pythons using global site-packages... so I figured it would be good to start clean (i had like... 5 versions before)

Hmm not sure I'd really go around deleting things that were installed my Mac OS.... grab your install CD and get the default Python back :)

Then install MacPorts type sudo port install python32 and you'll have a seperate install of Python 3.2 in /opt somewhere safe from the default one.

Try ActivePython . Not only does it automatically create symlinks in /usr/local/bin , but also comes with a tool called pythonselect which you can use to set the "active" Python version.

First thing you need to figure out is where your current installation is. The reason I ask is because I have several versions of python installed side-by-side though each with a different name. /usr/local/bin/python is just a sym-link to the real binary file.

For example, maybe you have /usr/local/bin/python-3.2 instead of /usr/local/bin/python. Once you know where it is, all you have to do is create a symbolic link to it via:

ln -s /usr/local/bin/python-3.2 /usr/local/bin/python

That's only an example of course and you're paths might be different. Also you'll have to run that command as root (sudo).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM