Set Up Python Virtual Environment In Visual Studio Code (VS Code)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey awesome guys in today's video I'm going to show you how to set up and configure python virtual environment using vs code so before diving into the tutorial if enable work with a python virtual environment before a python virtual environment is basically an isolated environment that everything you do stay within that environment and one of the benefits using a python filter environment is that when you have multiple projects and you want to make sure that each project is the appropriate version of python libraries in that case every single or python library that install only stay within that environment so it's going to be very easy for you to manage different python Library version so here my python VMV folder or directory so I have a list of photos and all these photos are my python environments so in my airflow environment Azure Cloud environment bigquery cloud storage and couple other uh python environments now let me go ahead and launch my videos call now to configure a python feature environment in vs code inside viewers go on to go to settings then click on settings on the top you want to search for python VMV now in My Views code I'm setting my VMV path to point to my uh my python VMV directory now if you have multiple python environments like me then you can set which one you want to use as the default and here I'm using my gcloud python feature environment as the default now once you set up your environment now if you want to create a new environment which I don't need to close a vs call right so let me go back now let me launch my terminal now I'm going to use the shortcut Ctrl shift p to open the command palette and I'm going to search for python slide interpreter all right so here I can choose different environment that I want to work with so for example if I'm doing uh data analysis work then I can choose my data analysis environment so sometimes vs code may fail to capture all the environments in that case I want to click on enter interpreter path and basically you want to merely uh browse the environment so in for example let's say VSCO failed to recognize my DBT demo uh python future environment actually not this one this one is empty I'll do gcloud they can navigate to my gcloud gr3 inside the director you want to search for actually this one is now in my mind all right so let's use Google apis I know for for sure that that's one of the environments that I use the most alright so inside the uh here let me zoom in a bit more foreign Scripts Now navigate to the scripts folder now I want to click on the python interpreter that assigned to the environment and the foundation should be python.exe select the file then click on select interpreter now let's say I'm working in a directory that is not under my python VMV directory all right so for example on my desktop I'm going to create a new folder I should uh new folder not a new file sorry all right so I'll go ahead and create a new python file let's call this demo.pi and within the new folder directory I'm going to launch my vehicle now if I open the demo.pi file now VSCO is going to uh detect the file type then it's going to automatically activate the default environment which is going to be gcloud now from the status bar I can click on the environment here on the bottom right corner to display all the environments that vehicle is able to detach now I can choose different environment that I want to work with in this case I want to choose my data analysis environment as the target environment now I can see that the current environment that VSCO is using is going to be the data analysis environment now at this point my demo.pi file will be able to access all the libraries under this data analysis environment such as a pain loss side Pi or map or Commanders so this is going to be something I'm going to cover in this video and hope you guys found this video useful and from the question any feedback please post it in the comment section below and as always thank you guys for watching I'll see you guys next time bye
Info
Channel: Jie Jenn
Views: 55,783
Rating: undefined out of 5
Keywords: VS Code, Visual Studio Code, Python Virtual Environment, Python Venv
Id: z2FSUtflnbY
Channel Id: undefined
Length: 5min 5sec (305 seconds)
Published: Sun Oct 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.