Answers for "vs code setup python"

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
0

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
Posted by: Guest on June-15-2021
1

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()
Posted by: Guest on August-05-2020

Python Answers by Framework

Browse Popular Code Answers by Language