[Pythonmac-SIG] IDLE fixes for 2.x and 3.x

Ned Deily nad at acm.org
Tue Feb 17 05:07:08 CET 2009


In article <805E7543-96ED-474F-8059-123B4085C29D at mac.com>,
 Tom Bridgman <cygnusx1 at mac.com> wrote:
> Is there a reliable way to install python 3 on a Mac without damaging  
> the resident installation?  Are there 10.4 vs 10.5 issues?

It's easy to install multiple versions and there should be no danger of 
damage.

The python.org 3.0.1 should install on any 10.4 or 10.5 system (actually 
10.3.x as well, though I don't think that has been tested).  It will 
install the Python framework at /Library/Frameworks/Versions/3.0 and it 
will install the folder /Applications/Python 3.0.  In the latter folder 
will be IDLE, Update Shell Profile, and some Extras.  By default, the 
installer will *not* modify your shell profile to add python3.0 to your 
shell $PATH.  You can access 3.0 by launching the 3.0 IDLE.  If you want 
to use python3.0 from a shell without making it your default python, you 
can type in the full path.

/Library/Frameworks/Python.framework/Versions/3.0/bin/python3.0

Or you can create a shell alias to that path (see below).

If you do want to make python3.0 your default python, either edit your 
shell profile to add the path of the framework bin directory to the 
front of your PATH or click on the "Update Shell Profile" command to do 
it for you.

The python.org 2.x installers work exactly the same way, installing into 
/Library/Frameworks/Versions/2.x and /Applications/Python 2.6 (or 
/Applications/MacPython 2.x for 2.5 and earlier)  All versions can 
co-exist with each other and with the Apple-supplied python which lives 
in /System/Library/Versions/Python.framework/2.5 for 10.5 and 2.3 for 
10.4.  The Apple-supplied python is also linked to from /usr/bin/python.  
(Like everything else under /System, the python files there are managed 
by Apple and should remain undisturbed.)

So, depending on which pythons you have installed, you could set up 
shell aliases in your shell profile, like:

alias python3.0=\ 
"/Library/Frameworks/Python.framework/Versions/3.0/bin/python3.0"
alias python2.6=\ 
"/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6"
alias python2.5=\ 
"/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5"
alias applepython2.5=\ 
"/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5"
alias macportspython2.5=\
"/opt/local/bin/python2.5"
alias finkpython2.5=\
"/sw/bin/python2.5"
...

By default, each instance of python has its own site-packages directory, 
so when installing packages, you need to pay attention to which python 
you are running.  If you are installing by hand, make sure you install 
to the right python by doing something like:

   python3.0 setup.py ...

If you want to use easy_install, you'll probably need to install 
setuptools in each python version.  For the python.org 2.x versions, 
download from and follow the instructions here:
   <http://pypi.python.org/pypi/setuptools>
The 10.5 Apple python comes with setuptools pre-installed linked at 
/usr/bin/easy_install.  MacPorts and Fink have setuptools packages.  You 
may want to create aliases to the various easy_installs.  There isn't a 
supported 3.0 version of easy_install yet but people are working on it.

It would be nice to have a more intuitive way to manage the nest of 
pythons.  There will be likely be some discussion and perhaps some work 
on that at the upcoming Pycon.

I'm sure I'm missing some details here but I hope that gives you enough  
to feel comfortable exploring 3.0.

-- 
 Ned Deily,
 nad at acm.org



More information about the Pythonmac-SIG mailing list