Can I have both Python 2.7 and Python 3.1 at the same time on the Mac?

Ned Deily nad at acm.org
Fri Jan 7 20:46:37 EST 2011


In article 
<AANLkTikNV-byMG+PXMTmRCv5mQqiKDOLEZjCLmeBem25 at mail.gmail.com>,
 Jason Swails <jason.swails at gmail.com> wrote:
> MacPorts!  They include a nifty little package called python_select that
> lets you switch default python versions on-the-fly and organizes everything
> for you perfectly.  I have python 2.4, 2.5, 2.6, 2.7, 3.2, and the system
> default 2.6.1 all installed, and
> 
> python_select python27
> python_select python32
> python_select python26-apple
> 
> switches seamlessly between them.  (I have so many versions to test script
> compatibility, not because I'm an avid collector).  In any case, this seems
> to be an ideal solution.

Unfortunately, that's not a complete solution.  The biggest hole is that 
it does not automatically solve the problem of scripts installed into 
the particular version's framework bin directory, neither all of the 
current scripts included in the standard python distribution nor 3rd 
party version-dependent scripts, things like easy_install, pip, etc.  
The former is easily fixed, the latter is harder to automate. The 
python.org installers take the route of providing a shell script app for 
each version to modify your shell login profile to insert that version's 
bin directory at the head of the $PATH env variable.  Modifying a shell 
profile is clearly not a particularly clean solution but it does 
actually work whereas python_select, in general, does not.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list