DEV Community

Fire rose
Fire rose

Posted on

Manage multiple versions of Python in same machine

Timeline of Python releases

Release timeline of Python

image.png

Source https://devguide.python.org/versions/

Install Python 3.11.3

Download latest version of Python (3.11.3) at https://www.python.org/downloads/ (25 MB)

Python launcher in Windows operating system.

image.png

Type

>>> exit()
Enter fullscreen mode Exit fullscreen mode

for existing.

Install Python 3.10.10 in the same machine

Download Python 3.10.10 at https://www.python.org/downloads/windows/ , https://www.python.org/ftp/python/3.10.10/python-3.10.10-amd64.exe , then install in the same machine with existing Python 3.11.3 .

image.png

image.png

image.png

Run Python 3.10.10 from Python 3.11.3 launcher

py -V 3.10
Enter fullscreen mode Exit fullscreen mode

Install Python 3.9.13 and so on (3.8, 3.7)

Link download https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe

image.png

image.png

image.png

image.png

Active Python 3.9.13

py -3.9
Enter fullscreen mode Exit fullscreen mode

Few helpful commands

image.png

py -3.9 -V
Enter fullscreen mode Exit fullscreen mode

Run Python file/project with a specific version of Python

Create folder D:\temp_2023_05_11 , inside this folder, create file get_version.py has content

print(__import__('sys').version)
Enter fullscreen mode Exit fullscreen mode

image.png

Then run

cd /d D:\temp_2023_05_11
dir
py -3.9 get_version.py
py -3.10 get_version.py
py -3.11 get_version.py
Enter fullscreen mode Exit fullscreen mode

image.png

Top comments (0)