Install & Manage Multiple Python Versions

Install & Manage Multiple Python Versions

How To Download A Specific Python Version In A Virtual Environment

Hi👋, I am doing this tutorial because It seems there is no straight way to install multiple versions of python on the same machine and in my case ( Windows 10 +).

image.png There are many reasons why you would want to do this and for my case: Some python libraries and packages I am trying to use require a specific python.

So let's get started :

✔ Head Over to Python Official and download the version you want:

✔ To check the current Python Version on your machine image.png

✔ You can alternatively use python --version

✔ Customisation image.png

✔ Select what you want from optional features

image.png Note: Please Do not select Py Launcher!

✔ Advanced Options: You can leave the default image.png

✔ Create a new folder & in my case, it is Old Python
image.png

✔ Install to our Old Python folder

✔ Set Up should be successful if you followed along:

image.png

✔ Now, confirm to see if the path variables have our new python folder and scripts and remove them. Just double-check to be sure!

✔ So we create a new TestV folder where we shall create the virtual environment.

✔ Open Terminal as administrator.
Change directory to your test folder.

cd C:\Users\Ronnie Atuhaire\TestV

✔ Enter the following command: We shall use virtualenv and if you do not have it on your global python, just pip install virtualenv first.

python -m virtualenv -p="C:/Users/Ronnie Atuhaire/Old Python/python.exe" test

As you can see, we are using the -p tag to specify our python executable and if there is space in your directories like mine, you wrap it in quotes(strings).

Please also note that I used forward slashes otherwise you will encounter file errors image.png That should be the output:

✔ We can now activate our terminal

test\Scripts\activate

✔ Check Python Version:

python --version

You can now install your packages under the activated environment and you can use pip freeze to specify them.

image.png ✔ To deactivate: deactivate

That's it!

If you enjoyed reading, consider subscribing and reacting to this with love by sharing, commenting and any criticism is much welcome.

📢Follow me on Twitter:

Ronnie Atuhaire