Skip to main content

Windows command-line tool to switch between different installed versions of Python.

Project description

Description

From the command-line, run:

> pychoose.py XY

This will make Python version X.Y active, if it is installed, for subsequent commands from the same prompt. The change is local to this shell.

The prompt is modified to indicate the modified environment.

To revert to the previously used version of Python, type ‘exit’

This works by starting a new Cmd shell with a modified PATH, by prepending C:\PythonXY and its subdirectories, and importantly by removing any other C:\PythonZZ directories and subdirectories.

Multiple invocations of pychoose can be nested.

Dependencies

No dependencies other than Python itself. Only tested on 2.4, 2.5, 2.6.

Installing

Windows users may download and double-click a graphical installer from http://pypi.python.org/pypi/pychoose.

Command-line jockeys with setuptools installed may use:

easy_install pychoose

or, if pip is installed:

pip install pychoose

or download a zip of the source from http://pypi.python.org/pypi/pychoose and use:

python setup.py install

Alternatively, to check out the latest unstable source from subversion, including tests, see:

http://code.google.com/p/pychoose/source/checkout.

Known Problems

Doesn’t modify PYTHONPATH. Should it ever?

Should get install dirs of various Python version from the registry, insted of assuming they are all variations on C:\PythonXX

Doesn’t affect Windows .py filetype associations. Perhaps this could be tackled by inserting an environment variable into the registry keys, set the env var in the registry (to persist its default value) and then change that value temporarily and locally in this script.

Should be cross-platform, but isn’t yet. As I understand it, on other platforms we wouldn’t even have to start a new shell to work.

Currently adds all subdirectories of PythonXX to the PATH. This is probably overkill. Can we filter out desired subdirectories with any reliability?

License

Pychoose is distributed under the BSD license. Live long and prosper.

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page