Installing Matplotlib in Visual Studio Code

Veröffentlicht am: 25 Januar 2021
auf dem Kanal: Cool IT Help
132,765
953

In this video tutorial, we will learn to use "matplotlib" and "numpy" packages to create a graphical plot as is commonly done with data science.

Step 1: Create a file with the name: firstplot.py
******************************************
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 20, 100)
plt.plot(x, np.sin(x))
plt.show()
*******************************************

Now run the file in the debugger using the "Python: Current file"
you would see a message, "ModuleNotFoundError: No module named 'matplotlib'". Such a message indicates that the required package isn't available in your system.

Step 2: 'matplotlib' package installation (which also installs numpy as a dependency):

open Command Palette to run Terminal: Create New Integrated Terminal (Ctrl+Shift+`).

Note: We will create a virtual environment and install the required packages, Such isolation reduces many complications that can arise from conflicting package versions.

**Enter the following command:
py -3 -m venv .venv
.venv\scripts\activate

Important:
***********
If the activate command generates the message "Activate.ps1 is not digitally signed. You cannot run this script on the current system.", then you need to temporarily change the PowerShell execution policy to allow scripts to run.

Set -ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

Step 3: Select your new environment by using the Python: Select Interpreter command from the Command Palette.

Run the following command:
python -m pip install matplotlib

Step 4: Deactivate environment:
Once you are finished,
type "deactivate" in the terminal window to deactivate the virtual environment.

If you found this video tutorial useful and would like to support me, you can do so by buying me a coffee using the below link!
https://buymeacoffee.com/CoolITHelp

***Other Best VS Code Tutorial by Cool IT Help****

Seaborn setup in Visual Studio Code
   • Seaborn setup in Visual Studio Code  
How to create a Maven Based Web Project in Visual Studio code? | Maven Setup VS Code
   • How to create a Maven Based Web Project in...  
Apache Tomcat 9.0 Setup and Web Project Deployment in Visual Studio code
   • Apache Tomcat 9.0 Setup and Web Project De...  
Using SonarLint in Visual Studio Code
   • Using SonarLint in Visual Studio Code  
Installing Matplotlib in Visual Studio Code
   • Installing Matplotlib in Visual Studio Code  
Configure and Run Debugger on Python program in Visual Studio Code | Beginner's Tutorial
   • Configure and Run Debugger on Python progr...  
Setting up Python Development Environment in Visual Studio Code | Tutorial for Beginners
   • Setting up Python Development Environment ...  
How to connect SQLite database with Visual Studio Code?
   • How to connect SQLite datbase with Visual ...  
Running a java program in Visual Studio Code on Mac OS X Catalina | Java Setup VS Code
   • Running a java program in Visual Studio Co...  
Running C/C++ program in Visual Studio Code on Mac OS X Catalina
   • Running  C/C++ program in Visual Studio Co...  
How to run C and C++ programs in Visual Studio Code (Windows 10)?
   • How to run C and C++ program in Visual Stu...  
Regex Previewer | Useful Extension for Visual Studio Code for live testing your regular expressions.
   • Regex Previewer | Useful Extension for Vis...  
How to completely uninstall Visual Studio Code from windows?
   • How to completely uninstall Visual Studio ...  
How to setup JavaFX Environment in Visual Studio Code?
   • How to setup JavaFX Environment in Visual ...  

How to run a java program in visual studio code? | Java setup in VS code
   • How to run java program in visual studio c...  


#MatplotlibVScode #CoolITHelp


Auf dieser Seite können Sie das Online-Video Installing Matplotlib in Visual Studio Code mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Cool IT Help 25 Januar 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 132,765 Mal angesehen und es wurde von 953 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!