I wanted to use the 32 bits python because I need a module that only works with the 32 bits version, but I don't want to use the 32 bits version always, but when I run a script, it runs with the 32 bits version, always. What can I do to only use the 32 bits sometimes, and leave the 64 bits for default use?
There are four different ways that Windows chooses which Python to run.
- If you type
python foo.pyat a DOS prompt, it goes by which one is found first on the PATH. Normally, the installer for each version puts that version at the start of your PATH, so whichever one you installed last wins.
- If you double-click
foo.pyin Explorer, it goes by Explorer's file type association mapping. Normally, the installer sets the association to its version, so again, whichever one you installed last wins.
- If the latest one you installed was new enough to have the "Python Windows Launcher", it will actually set that, rather than Python itself, as the Explorer mapping. The launcher will first look for a Unix-style #! line at the top of your script and run whatever's specified there.
- If you have the launcher, and your script doesn't have a #! line (or has a Unix-specific one that doesn't work for you), it will look in a whole slew of places (most importantly
py.ini) to decide which one is the default. Again, normally, the installer sets the default to its own version… unless you already had a strictly higher version.
So, the best thing to do is to learn how all of this works and edit your
PATH, Explorer association mappings, and all of the relevant stuff for the launcher.
See PEP 397 for the full details on new-enough versions and as-good-as-you're-going-to-find partial details (in the Rationale section) on older versions.
But the easiest thing to do is to re-run the 64-bit installer, make sure to leave on all the checkboxes, click OK if it asks something like "are you sure you want to override the existing settings", and your 64-bit Python will be the default again.
Or, if you've installed a GUI IDE (other than IDLE), many of them have an option somewhere in the menus to "give me a list of all installed Pythons and set the one I choose as the default" (or, for the ones written in Python, possibly just to "set this Python as the default").