How to Use Different Python Version in VirtualEnv (2023)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's see how we can use different versions of python in Virtual environments so I'll just open this folder and we'll create our virtual environments here now to use different python versions in Virtual environment first you need to make sure you have different python versions actually installed if you have just one python version installed you will only be able to use one virtual environment or one python version in that virtual environment so if you don't know how to install different python versions check the first link in the description and you will see how you can install different python versions okay once you have different python versions what you can do is open your command terminal or your parowal window and go to your project directory and first let's create a python version sorry let's create a virtual like this right my this would create a virtual enement here so as you can see I think this is created and if I go here and if I refresh this thing yeah this virtu member is created now if I double click this and go inside libraries and stuff let's go inside scripts as you can see p 39 and uh if I go to include here I'm just trying to see what version of python is installed so uh if you go here and you see pip 3.9 so this means that python 3.9 is being used in this version envirment so now this is what I've done so I can create virtual re for different python verions right so if I Ty python 31 mvv and my new V andv hit enter now this command will not work for you just in a minute I'll show you how you can make this work so a new virtual will be created now let me go back and this as you can see new virtual is created if I go inside this and go here as you can see it shows python 31 python 3.11 so a new virtual environment has been created with python 3.11 so how did I do this I'm sure this will not work in yours at the moment because if I check python D Das version it is showing pyth 3.9 right and if I check python 31 d d version it show python 3.11 so if I make virtual en using this pth 3.11 will be used and if I make virtual using this python 3.9 will be used so how did I do this so first of all you need to know where each version of your python is installed by default python versions are installed in as you can see here I go here so you can go inside your username app data local programs and Python and I have three python versions installed here now to make sure you are able uh you are able to use something like this what you need to do is so if I type python I want to use Python 3.9 right so leave python 39 alone now if you want to use Python 3.11 when you type python 31 go inside python 311 folder and you need to rename python.exe initially this is like this right there is no python 31 it's like this python.exe you need to rename this to python 31 python 32 python 2 or whatever you want and then you will be able to use Python 31 D Das version after adding this to your envirment variable now if we have not added this path to your envirment variable you can just press windows and type environment go to envirment variables click path and then click edit and then paste this path and click okay and now you will be able to use path 31 to do this if you have any questions about adding python variables to envirment variables uh you can check my link in the description so this is how you can create different alyses and you can use different python versions using different Alas and then whatever you use python or python 31 or whatever you want to type and the virtual mment will be created using that python version if you have any questions let me know in the comments below
Info
Channel: The Code City
Views: 10,485
Rating: undefined out of 5
Keywords: how to use different python version in virtualenv, different python versions, python versions virtualenv, python virtualenv, use different python versions, different python versions virtualenv
Id: sgSg10kjZxw
Channel Id: undefined
Length: 4min 23sec (263 seconds)
Published: Sat Nov 11 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.