In the previous post we learned about Virtual environments in Python. In
this post we will learn how to set up VSCode for Python.
VSCode is very popular, lightweight and highly customizable. Let's follow
below steps to setup VScode from scratch.
Navigate to here and
download VScode executable for windows.
Double click on downloaded file and in
License Agreement window select "I accept the agreement" and click on "Next".
In Select Destination Location window click on Next.
In Select Start Menu Folder window click on Next.
In Select Additional Tasks window check
Create a desktop icon and click on Next.
In ready to install window click on "Install".
Wait for the installation to complete and click on
Install Python Extension
Open the VSCode and click on Extensions.
Search for Python extension and click on
Create New Python File
Click on File->New File and select
Save the file as hello_world.py.
print("hello world") in the file and save it.
Press Ctrl + Shift + P, and type
Python: Select Interpreter in the prompt.
Select the Python Interpreter. You can choose the base interpreter or can
navigate to the interpreter created in previous article.
Run the programme
Click om Terminal -> New Terminal and type
python hello_world.py in the terminal and hit enter.
After running this script you should see
hello world printed in the terminal. Now we have VSCode installed, let's create a directory where we will keep all our Python files for the next tutorials.
Create directory with name python-with-gcptutorials and open the directory with VScode using below commands.