X

Get Started with Visual Studio Code with Python

VsCode-with-Python

Visual Studio Code with Python

Visual Studio Code is the new kid on the block and it has lots of bells and whistle including using Visual Studio Code with Python.

Requirements

To install vscode, just go Visual Studio Code website. Its a very simple click through process if you are using Windows.

If you are using Linux, then you will need to download the .deb package and use the command to install it, replace the filename below.

$ sudo dpkg -i [vscode-package-version].deb

The other requirement is to download python, again its a simple process if you are using Windows, just click through. I wont go through the python install process. Just go through Python Download section. I personally use the 3.x series, since I like being latest 🙂

Once you have visual studio code installed you can launch vscode and click on extension tab and search for python.

vscode-python-1

I use the Don Jayamanne Python extension, and then click on install.

vscode-python-2

Once the plugin is installed you can reload vscode.

Open up a new file and name it sample.py and type the following code into it. Remember spaces in python are important

for i in range(0, 10):
    print("hello" + str(i))

We can then click on the debug tab and debug the python code, lets put a breakpoint in the print statement, one can also add a Python configuration. When you debug you will be able to see your variables values also like below.

vscode-python-3

Hope this will help you in getting python running in VsCode.

Categories: VSCode
Tags: pythonvcode
Taswar Bhatti:
Related Post