Joshua
Joshua

Reputation: 26732

How do I uninstall python from OSX Leopard so that I can use the MacPorts version?

I want to use the macports version of python instead of the one that comes with Leopard.

Upvotes: 19

Views: 22771

Answers (7)

chipiik
chipiik

Reputation: 171

python_select is now deprecated, use this instead:

sudo port select python python26

Upvotes: 17

Simo Salminen
Simo Salminen

Reputation: 2306

The current Macports installer does the .profile PATH modification automatically.

Upvotes: 3

bryan
bryan

Reputation: 2243

Use the python_select port to switch python interpreters.

sudo port install python25
sudo port install python_select
sudo python_select python25

This will symlink /opt/local/bin/python to the selected version. Then export PATH as described above.

Upvotes: 20

jacobian
jacobian

Reputation: 4728

Don't. Apple ships various system utilities that rely on the system Python (and particularly the Python "framework" build); removing it will cause you problems.

Instead, modify your PATH environ variable in your ~/.bash_profile to put /opt/local/bin first.

Upvotes: 29

freespace
freespace

Reputation: 16701

I wouldn't uninstall it since many scripts will expect python to be in the usual places when they do not follow convention and use #!/usr/bin/env python. You should simply edit your .profile or .bash_profile so the macports binaries are the first in your path.

Your .profile should have this line:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

If not, add it in, and now your shell will search macport's bin/ first, and should find macports python before system python.

Upvotes: 3

John Millikin
John Millikin

Reputation: 200846

Instead of uninstalling the built-in Python, install the MacPorts version and then modify your $PATH to have the MacPorts version first.

For example, if MacPorts installs /usr/local/bin/python, then modify your .bashrc to include PATH=/usr/local/bin:$PATH at the end.

Upvotes: 4

Greg Hewgill
Greg Hewgill

Reputation: 993901

I have both installed:

$ which python
/usr/bin/python
$ which python2.5
/opt/local/bin/python2.5

I also added the following line to my .profile:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Upvotes: 22

Related Questions