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 +).
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
✔ You can alternatively use
✔ Select what you want from optional features
Note: Please Do not select Py Launcher!
✔ Advanced Options: You can leave the default
✔ Create a new folder & in my case, it is
✔ Install to our
Old Python folder
✔ Set Up should be successful if you followed along:
✔ 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 That should be the output:
✔ We can now activate our terminal
✔ Check Python Version:
You can now install your packages under the activated environment and you can use pip freeze to specify them.
✔ To deactivate:
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: