close

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

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to install and use both python 3.8 and 3.7 on windows 10 in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

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

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

    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).

  2. install and use both python 3.8 and 3.7 on windows 10

    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).

Method 1

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.

Method 2

Using virtual environment you can install several python versions and more importantly you can install different modules version for each of those python revision (the main reason for running different python version is that some modules are not (yet) compatible with recent python releases). You can check how to create/update and activate different virtual environment here. Those env can use their own python version or share it, it is chosen at creation time (the python version you use when creating the env is the one that will be used any time you activate the env).

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read