Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I have to uninstall old python versions to update to a new one on Windows?

I have python 3.2 installed and I want to know if I have to uninstall earlier versions before installing newer ones.

like image 911
bzrr Avatar asked Sep 20 '13 01:09

bzrr


People also ask

Do I need to uninstall old Python version?

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.

How do I upgrade to a newer version of Python?

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.

How do I remove old Python from Windows 10?

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.

Can I have different Python versions installed?

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.


1 Answers

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.

like image 154
Mark Tolonen Avatar answered Sep 22 '22 09:09

Mark Tolonen