Python - Setup Visual Studio Code with Anaconda

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video is going to cover how to download anaconda and set it up to be used in Visual Studio codes so you can see here that I've already downloaded Visual Studio code but I don't have any projects open right now so first demo Visual Studio code it's really easy to do go online search for download Visual Studio code and follow the instructions there and once you do that you can catch back up here or start well where we'll start to download anaconda and then econo for those of you who don't know provides tools for working with the Python and with the Python programming language okay and so I'm just going to go over to the Internet here and I'm going to search for download anaconda I'm gonna hit enter and we can see we have this free download here and so I'm gonna go here and this is a Python distribution that includes some other tools and so I'm going to download the Python 3.7 version which is the most current version right now I'm using a 64-bit machine so I'm going to use the 64 bit graphical installer and you can see that this is uh almost 500 megabytes this will take a little bit of time to download so I'm gonna click download here and then just pause this video while I download this installers I'm gonna click Save and it's downloading over here so I'm gonna pause this video while that finishes okay so my anaconda installation or my my downloading the Installer is finished so I'm going to just click on that installer to run it and it will open up here in just a sec working on it here we go getting this set up and I'm just going to go through the install options here so we're gonna click Next I'm going to agree I'm just going to keep all the recommended settings so that you can do this the same way on your machine next I'm going to keep the default here next and it's going to go ahead and install this and it could take a cup minutes I think in setting up the package cache can take a little time so once again I will pause this video while this finishes installing and turn it back on once ready to continue okay so my installation is complete and I'm going to go ahead and click Next here and now I can go ahead and click Next again and you can see that this is is tightly integrated with the PyCharm IDE I'm going to show you how you can use this individual studio as well so we can click Next and I'm just gonna uncheck these boxes this will go to visual studio and I'm gonna click finish here now all right so let's go back over and go to visual studio and make sure we get this set up so that we can access our anaconda installation so the first thing you want to do in visual studio is install a python extension so in Visual Studio this button over here that looks like it's greeted with the corner coming off that's your extensions panel so go ahead and click on that and you can just search for Python online it pops up right here this PI thump extension that's by Microsoft if you don't have it pop-up you can type in python in the search bar and it should be the first result okay so i'm gonna install this extension it's gonna pop up here i'm gonna come over and click install and this will take just a minute to install so once again i'll pause the video while it finishes installing okay so we're done installing you can see instead of having the option to install i now have the option to uninstall we're gonna just click this button over here to go back to my explorer with my file that goes to my files that goes there and i can close the extension window here okay so we're back here okay so now what I need to do is I need to be able to set up the interpreter that I want Visual Studio code to use and the first thing I'll do to do that is I'm gonna do ctrl shift P and that opens up this palette is what it's called and I want to find my user settings so if I do open user settings you can see has preferences open user settings and once I have this opened I'm going to search for the Python path and so once I'm here in my user settings I want to find the Python path variable and change that and I can do that by searching for Python here and you can see that once I do that it subsets the variables and we want to find python path so you have to scroll down until we can find that python path variable which I believe is down towards the bottom and it might be easier to just type in Python path directly up here maybe that'll make it a little easier for us okay so we have virtual environments we have a get path let's see here okay so here's python path right down here at the bottom of the screen alright so there we are and so here we're going to just want to make sure pointing to the correct path for our Python installation and we can double check this by going to where we installed anaconda and for me I installed it the default location is gonna be under users you or username and then you should be able to see anaconda three right here okay and then we're looking for a Python executable and you can see that I have this Python executable right here and if I link to this that will give me the base installation of Python okay and we can go over virtual environments or environments in a different video so I'm looking for the Python exe right here okay and so here's the path of that I'm just gonna copy that in case I need it and we'll go back over to Visual Studio code okay so now where this says Python I'm going to paste that path and remember that it was Python exe that is going to be a Python interpreter we want to use here okay and so now I have that set and we should be good to go so what I want to do now is I want to come back over here and I want to open a folder and make a project and test this out so I'm going to go open folder and I'm gonna go to just my downloads where I do a lot of testing so we'll do tests and I'll select that test folder to open okay visual studio code open there and now I want to add a file to this folder and I'm gonna call it test type dot py I'm going to hit enter and you can see here we're activating an extension down in the bottom left corner so you can see python extension is loading so this is the need to download and install python before using the extension we already have it installed so we'll see if we can actually get this to work you'll see you notice down here that we have python three point seven point four is recognized and it says base Conda in the bottom left so it looks like it's recognizing our base Conda environment which is exactly what we want to have happen okay I don't know why I'm getting this message saying it's not installed because we haven't installed now we can test and see if this is actually going to work and so let's go ahead and do just that and so we can do is let's just import OS and which is and then let's do print current directory and then we'll do another print which will be OS that get CWD and I'll just double check my syntax and make sure we're right there that should be correct so I'm just going to go ahead and do ctrl s to save that file and then we can click this Run button up here and it will run down below in the terminal here and so we should see if this works you can see we're activating our base environment and okay so it's not recognizing Conda for some reason but you can see that we did print out current directory and I printed out the location here so I'm not exactly sure ok so what's happening here it's just not recognizing Conda okay because anaconda comes with the terminal environment and we're just not letting up for that terminal here and that's okay you can see that our Python interpreter here is working okay and so we just want to call Conda activate base to activate the base environment it just didn't recognize that call but it does recognize that we have Conda installed here alright so we have a set up so that we can now do Python operations with anaconda and just to prove this to you let's just do a basic multiplication let's do 1 times 2 and then let's do another one and we'll do - well do two to the third power right which will be 8 and so let's just print those out and show that this would indeed work so I'll run this and you can see that we've printed out our current directory we've printed out the path of that directory printed out - we've put it out 8 and we did not get that error again once the terminal was activated for the first time and so that was just an error activating the terminal me and the environment that the terminal didn't recognize we do have access to python and the anaconda installation of python here through visual studio code
Info
Channel: Open Source Options
Views: 253,307
Rating: undefined out of 5
Keywords: open source, open source options, python, anaconda, visual studio code, vs code, vsc, visual studio, vs code python, visual studio code anaconda, visual studio code python, vs code anaconda, python ide, ide, python programming, python anaconda, install anaconda, visual studio anaconda, visual studio python, open source software
Id: sts3CFewvkY
Channel Id: undefined
Length: 10min 41sec (641 seconds)
Published: Mon Feb 03 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.