Answers for "vscode install python library"

5

installing python packages in visual studio code

py -m pip install numpy
Posted by: Guest on November-01-2020
1

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
Posted by: Guest on February-27-2021

Code answers related to "vscode install python library"

Browse Popular Code Answers by Language