installing python packages in visual studio code
py -m pip install numpy
installing python packages in visual studio code
py -m pip install numpy
how download library python vscode
"""
example: install matplotlib + numpy
open commandprompt(Win + R -> cmd)
"""
#fist of all make sure u have python installed
py -3 --version
#make the python project
#code:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 20, 100) # Create a list of evenly-spaced numbers over the range
plt.plot(x, np.sin(x)) # Plot the sine of each x point
plt.show() # Display the plot
#press F5
#You are going to get this error:"ModuleNotFoundError: No module named 'matplotlib'"
#this means matplotlib is not installed yet
#then press Ctrl + shift + ù this will open a command prompt for the porject.
#type the following command and confirm you want to create a new virtual envirroment:
py -3 -m venv .venv
.venvscriptsactivate
#select the new envirroment by pressing (Ctrl + shifft + p)
#type "select interpreter" and select the ('.venv') interpreter
#the last step is to run the following command in the cmd
python -m pip install matplotlib
when running the script (F5) it should work now
Setup VS Code for python
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 20, 100) # Create a list of evenly-spaced numbers over the range
plt.plot(x, np.sin(x)) # Plot the sine of each x point
plt.show() # Display the plot
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us