Creating Virtual Environment for Python in VS Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome back to my channel so today I'm going to show you how to create python virtual environment using vs code so for that I will first go to my D drive and I have created a folder named Python and I will open this folder with vs code by right clicking and clicking on open with code so this is the vs code has opened in the folder and as you can see this is the terminal you can get this terminal option from the top and by clicking on new terminal and don't forget to set this terminal to command prompt okay if your terminal is by default Powershell then you might face some problems while creating the virtual environment now let's start creating the virtual environment go to the terminal and type python Dash aim v e n v and then the virtual environment name so I am giving the virtual environment name as test and click enter it will take some time to create the virtual environment as you can see on the left the test folder has appeared this is the virtual environment inside it we have a folder named scripts and if you open this script there should be an activate file but uh yes now the activate file has come in my folder if activate file is not there in your folder then wait for some more time until it comes okay now as you can see my virtual environment is created since the activate.bat file is there now let's activate this virtual environment so how we will activate by giving this command dot slash test is the virtual environment name we have to give that virtual environment name then slash Scripts slash activate and click enter okay the system cannot find the specified path or I have given the wrong script name it should be scripts so this is the comment and click enter and as you can see I'm scrolling down as you can see the test virtual environment is activated the test is written within bracket means the test virtual environment is activated okay if you are facing some problem then go to this view option on the top and click on comment palette and click on select interpreter and make sure the test environment is selected okay in case you have some Anaconda jupyter notebook installed then you can change it to the normal python I am using the python which I have installed in my system so as you can see I also have a anaconda python test virtual environment I am not selecting that I have selected the test environment which I have created right now so make sure you select the right environment and now let's test whether the environment is created successfully or Not by running a simple python code I am clicking on this new file option and creating a python file sum dot pi and I will add two numbers a equals to 10 and b equals to 20. sum equals to A plus b and I will print this sum print sum run this file by going and clicking on this top right play button and as you can see in the terminal the answer came as 30 so the python virtual environment is created successfully and we have also seen that a python file is also run successfully so this is it if you like my video please subscribe to my channel and share with your friends thanks for watching my video have a nice day
Info
Channel: Tech Coffee Break
Views: 33,846
Rating: undefined out of 5
Keywords: python, virtual environment, vs code, create virtual environment in VsCode
Id: WtBT2U3okvA
Channel Id: undefined
Length: 4min 2sec (242 seconds)
Published: Sat Oct 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.