How to Configure Visual Code Studio for Python

Hello Friends, Today I show you how to configure visual studio code (vs code) for python. you need python compiler to run the python program and many python compilers come in vs code so which have you choose python compiler depends on you.

So, First, you have installed the vs code & python in your system, if you have not to install vs code, if you no know how to install them into the computer so click here and also if you no know how to install python into system then click here otherwise then go to next step.

Let’s open your vs code and first create a folder where you can save python files and projects & open folder in vs code which have you created and click New or Open your python file and write some code and save it to index.py or another name.py extension.

On the right side screen message shows up “The Python extension is recommended for this file type”. this extension is a compiler for python who’s that compile or runs your python file.

Install this Python Extension in your vs code for your python files and some seconds wait until it has completed now.

Now, it’s time to compile or run the program so you have many options to compile the code into vs code. The first option is press F5 then you see the debug configuration then select the Python file into the debug configurations section.

The second option is that you can run the program directly into python terminal. Just right-click and select the option “Run python file in Terminal” then program output shows into python terminal.

The third option is fixed-configuration and just one click output will be shown. so first click debug option from left side vs code then click add configurations or click configuration button(third) then now one file will open ‘launch.json’ then now type python in the file and enter the python then one box open & select the python file option and press enter.

after press enter python configuration lines automatically added in launch.json then save it, after all, that open your python file (index.py) & click upper left side debug button (Green) then your output will be shown.

Hence, Your python configuration has completed now you can easily compile and run the python program. 

Leave a Reply