Separate Windows versions of Python

Scott David Daniels Scott.Daniels at Acm.Org
Wed May 6 11:35:51 EDT 2009


OldGrantonian wrote:
> I use Windows Vista Home Premium. I have Python 2.6 currently
> installed. I'm not a techy.
> 
> I want to use "virtualenv". When I try to install the latest version
> of virtualenv for Windows, I get the message that Python 2.5 is not
> found.
> 
> How do I install Python 2.5 (or anything else except 2.6) so that I
> use the correct version of Python at the correct time.
> 
> For example, do I need to edit the "path" variable each time that I
> want to change versions from 2.5 to 2.6?

On windows, major versions (..., 2.5, 2.6, 2.7, ...., 3.0, 3.1,  ...)
can coexist quite successfully.  Find and run an installer for the
latest version  of 2.5 (2.5.4, I believe) on the Python download page.
That will make 2.5 your default Python.  To switch the easiest way
(for you) is uninstall the version of python you want to be the
default, then install it again (making it the last one installed).
This suggests keeping installer binaries for all version you are
using.  Note that the this uninstall-reinstall should not affect
you loaded Python packages that you have installed separately.
To simply run a python program with a different python (but not
change the default), open a command window (run program / cmd),
sometimes called a "terminal window" and use command:
     C:\> C:\Python24\python program.py  # command line version
or
     C:\> C:\Python24\pythonw program.pyw  # gui verson
You can also change shortcuts to refer to specific Python versions.

Of course, the different Python versions should also be available
on your start menu.

However, Starting with Python 2.6, if you want user-specific
installation, you can also create and put things in (for example),
     C:\Documents and Settings\USER\Application Data\
                             Python\Python26\site-packages
where you replace USER with the user name in question.

If you are not planning to do a lot of switching, that might be
enough for you.  The base directory is also called %APPDATA% on
a command line or via os.path.expandvars.  Once you have created
this site-packages directory, Python 2.6 and later will use it to
find .pth, .py, .pyw, and .pyd files (as well as .pyc and .pyo
files).  You may find changing your personal site-packages directory
(and/or a .pth therein that you manipulate) will address the issues
that you are planning to solve with virtualenv.

Sorry for the long-winded answer.
--Scott David Daniels
Scott.Daniels at Acm.Org


in addition to the common site-packages directory on



More information about the Python-list mailing list