how to install python vscode code example
Example 1: getting started vscode python
py -3 -m venv .venv
.venv\scripts\activate
Example 2: 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
.venv\scripts\activate
#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
Example 3: how to get python to output in the terminal in vsc
py -3 --version
Example 4: visual studio code import library python
"python.linting.pylintArgs": [
"--init-hook",
"import sys; sys.path.append('/path/to/Functions')"
]
# OR
sys.path.append("/path/to/parent")
# option 1
from Functions import functions
functions.copy()
functions.delete()
# option2
from Functions.functions import copy, delete
copy()
delete()
Example 5: visual studio code python
HEEEELLLLLOOOOO PYTHOOONNN