ActivePython: multiple versions on OSX?

Chris Angelico rosuav at gmail.com
Tue Jul 26 19:07:32 CEST 2011


On Wed, Jul 27, 2011 at 2:33 AM, Melton Low <softw.devl at gmail.com> wrote:
> It's probably impractical.  You would need a pair for each version of Python
> installed, ie. (PYTHON26PATH,PYTHON26HOME) for 2.6.x,
> (PYTHON27PATH,PYTHON27HOME) for 2.7.x, .... for 3.1.x, for 3.2.x, etc).

You could set up a script for each version that looks for environment
variables in the right order, stopping when it finds one. Version
3.2.1 would look for PYTHON321PATH, then PYTHON32PATH, then
PYTHON3PATH, finally falling back on PYTHONPATH. It could then put the
appropriate path into PYTHONPATH (not overwriting the external
variable of the same name - if your shell doesn't do that for you,
just save it to restore later), and invoke Python.

Still seems fairly cumbersome, and doesn't handle the possibility of
having two separate installs of the same version number (different
builds of 3.3, or 32-bit and 64-bit Pythons, or something). It may be
easier to simply create some scripts that set up the environment
explicitly, and then invoke Python. Name 'em according to what you
want of them.

ChrisA



More information about the Python-list mailing list