I have python 3.2 installed and I want to know if I have to uninstall earlier versions before installing newer ones.
To ensure that you're not affected by bugs and security issues that have been fixed, removing the old version is necessary. While you can use more than one Python version on the same computer, installing a new version of Python before removing the old one sometimes breaks Python on the computer.
All you have to do is visit the Python downloads page and download the latest version. Clicking on the button will replace the existing version of Python with the new version. The older version will be removed from your computer. After you restart the computer, the new patch will be installed on your machine.
Navigate to Control Panel. Click “Uninstall a program”, and a list of all the currently installed programs will display. Select the Python version that you want to uninstall, then click the “Uninstall” button above the list – this has to be done for every Python version installed on the system.
If you wish to use multiple versions of Python on a single machine, then pyenv is a commonly used tool to install and switch between versions. This is not to be confused with the previously mentioned depreciated pyvenv script. It does not come bundled with Python and must be installed separately.
Install all the Python X.Y versions you want, but include Python 3.3 or later (last is best, or reinstall it after all the others) to get the Python Launcher that @abarnert mentioned in his comments. It is also available as a standalone installer.
Earlier versions than 3.3 should not register extensions, so the launcher installed by 3.3 or later will remain the default handler for .py
files.
From the command line:
py -2 # launch latest 2.x version installed.
py -3 # latest 3.x
py -3.2 # run exact version
py -3.2-32 # run 32-bit version on 64-bit system.
So you can even have mixed 32-bit and 64-bit installations.
The environment variable PY_PYTHON
can be set to specify the default Python to run.
In scripts, add a comment of the following forms below to use that version of Python when the script is double-clicked or run from command line via py script.py
:
#!python2
#!python3
#!python3.2
#!python3.2-32
See PEP 397 for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With