Paul S.
Paul S.

Reputation: 66304

Installing multiple main and bit versions of Python

What would be the best way/order to install both 32 and 64 bit versions of Python 2.7 and Python 3.3 if I want 64 bit Python 3.3 to be the default when I open .py files?

I already have the 32 bit version of each installed, with defaults set to Python 3.3.


If it is fine to just rename the directory of my currently installed version, will python27.dll and programmes using it (or python33.dll) continue to work? This library gets installed to %WINDIR%\System32 and/or %WINDIR%\SysWoW64 by the python installer.


Thanks for your answers, here is what I did:

  1. Uninstalled Python 3.3 (This left 2 files)
    • C:\Python33\Lib\lib2to3\Grammar3.3.0.final.0.pickle
    • C:\Python33\Lib\lib2to3\PatternGrammar3.3.0.final.0.pickle
  2. Uninstalled Python 2.7
  3. Installed Python 2.7 x86 (without register extensions)
    • C:\Python\27_32\
  4. Installed Python 2.7 x86-64 (without register extensions)
    • C:\Python\27\
  5. Installed Python 3.3 x86 (without register extensions)
    • C:\Python\33_32\
  6. Installed Python 3.3 x86-64 (with default register extensions)
    • C:\Python\33\
  7. Deleted C:\Python33
    • CCleaner'd installer reference issues to this location

Upvotes: 6

Views: 922

Answers (3)

Blckknght
Blckknght

Reputation: 104702

Use the PEP 397 launcher and configure it to launch your preferred version of Python. A copy comes with all versions of Python 3.3, or you can install it separately.

To elaborate:

Rather than launching Python by typing python in a shell, run py.exe (this should also be the default action for double clicking on a Python file if the most recently installed version is Python 3.3 or later). py.exe is a helper program that searches for and locates an appropriate version of Python on your system.

You can edit an .ini file in various locations to specify the default version, or your Python scripts can specify the version they expect to be run with (using a "shebang" line, as described in the PEP). So you can set your system default to be 64-bit Python 3.3, while also allowing individual scripts to use other versions on demand.

Upvotes: 2

BrenBarn
BrenBarn

Reputation: 251365

The installer typically has an option for "Set file associations" that handles that, and I think it's on by default, which means that the most-recently-installed one will handle double-clicking .py files. So install 64-bit Python 3.3 last and it should work. I just did this a few days ago with 32- and 64-bit version of 2.7 and it seems to work fine.

I wouldn't rename your existing directory, though. You should install each version of Python in its own directory.

Upvotes: 3

inspectorG4dget
inspectorG4dget

Reputation: 113905

I would use a virtualenv for each version (2.7/3.2) or flavor (32-bit/64-bit) of python you want to install. Essentially, a virtualenv is a sandbox for your installation, which doesn't leak through into other sandboxes.

This other SO question explains how to make virtualenvs

Upvotes: -1

Related Questions