How to Install Matplotlib in Python and Run in Visual Studio Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up you guys welcome back to codewizard today we're going to be talking about how to install the matplotlib library in python and then we're going to run a program using that library in vs code so you can see here i have vs code opened up and we have a program called demo.py that is using the matplotlib library and all this program is going to do is just simply build a basic graph where these numbers here are the x coordinates or the x numbers and these are the y numbers okay and then we label them y numbers x numbers pretty straightforward and then we show the plot if i were to run this program we would actually get an error right now and i'll show you if i go to terminal click on new terminal to run the python program i make sure that i'm in the same directory which is the folder that i'm in demo and i'm going to type in python 3 and then the name of the program demo dot py and then to run the program i hit enter and you can see here we have this error the error says module not found error no module named matplotlib and the reason why we're getting this error is because we do not have the matplotlib library installed so we're going to go ahead and install the library now to install the library go ahead and visit the website matplotlib.org and this is the official website for matplotlib python library and when you get here click on installation it'll come to this page here and in the installation page what you want to look for these two commands here it says installing an official release and we have these two commands that we're going to actually type into the terminal now if you're running python version 3.4 and later then you do not need this first command here this first command simply installs pip which is used to install python libraries however python versions 3.4 and later do not need this command because you already have it installed it actually comes with pip okay so the only command we actually need is this command here which is the second command so i'm going to go ahead and highlight it and copy it now come over to my terminal now what i just said with the python version if you want to know what python version you have you can just simply type in python 3 dash version you can see here i got python 3.9.2 if you have an earlier version of python and you don't have pip installed you can simply just go to the python website and just click on install and we'll install the latest version of python but we have the latest version we have pip so now we're going to type in our command that we just copied from the matplotlib website now before you hit enter one thing you do want to change with this command is change python to python 3. then you can press enter and that's it that's basically how you install the matplotlib library for python now i'm going to go ahead and try running my program again alright so i'm going to type in python3 demo dot p y i'm gonna hit enter so there you go you can see it produced a matplotlib graph coming from the matplotlib library and that is all there is to it so if you guys have any questions feel free to leave a comment down below like subscribe and thanks for watching you
Info
Channel: Code Wizard
Views: 110,744
Rating: undefined out of 5
Keywords: how to install matplotlib in visual studio code, how to install matplotlib in vs code, how to run matplotlib in visual studio code, how to run matplotlib in vs code, how to install matplotlib python library, matplotlib installation, python matplotlib, matplotlib tutorial, matplotlib installation tutorial, ModuleNotFoundError: No module named 'matplotlib', no module named matplotlib, how to run matplotlib for python
Id: -Wvt7lWxzf4
Channel Id: undefined
Length: 4min 4sec (244 seconds)
Published: Sat Apr 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.