Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and use both python 3.8 and 3.7 on windows 10

How to use Python 3.8 and 3.7 on Windows 10. I want to make two applications, but one requires 3.8 and another one 3.7. So how to manage both versions in one Windows 10.

like image 484
user3030327 Avatar asked Aug 31 '25 17:08

user3030327


1 Answers

You should just install Python 3.7 and Python 3.8 and make sure that the Python Launcher for Windows is also installed (this is the default).

Then you could run your scripts using py -3.7 main.py or py -3.8 main.py to run main.py using Python versions 3.7 or 3.8, respectively.

Alternatively (even better actually), you could write the required Python version in the first line of your Python script:

#!/usr/bin/env python3.7

Note that this must be the first line of the script, otherwise it doesn't work. Now just running py main.py would automatically select the correct Python version to execute the script.

NB: If the script is executed in Linux it would also run with the correct Python version.

like image 138
wovano Avatar answered Sep 02 '25 07:09

wovano