So, you've started learning Python, and you're all hyped up, but You don't know how to download And install Python With Visual Studio Code?
Don't worry! We'll help you, and you'll be writing code in no time.
Before you can turn your ideas into code, you need Python to be installed, along with a Code Editor, in this case, Visual Studio Code.
Let me take you step-by-step through this process and show you How to Download and Install Python with Visual Studio Code.
How To Download And Install Python With Visual Studio Code in 2022?
First, you have to download and install Python and then install a relevant Code Editor. The code editor could be Visual Studio Code or PyCharm. Then you have to set up a couple of Visual Studio Code extensions. Finally, create your first Python File, and execute the first line of Python Code. And you're all set up for conquering the Python world of Coding!
Let's cover this in detail!
Here's what we'll be covering:
- Downloading and Installing Python
- Download, Install, and Setup Visual Studio Code
- Create a Python File, and Execute with Printing “Hello World”.
Download and Install Python
First off, let's go ahead and download Python.
Go to your google search bar and type download python, and open the first link. Or you can skip and press on the below link.
This page automatically detects your System, whether it be Windows, Mac, or Linux. So, you do not need to worry about selecting and downloading the correct version of Python for your specific operating system.
So I'll open the website and download python. (https://www.python.org/downloads)
Once it's done, double click to run your downloaded file found in your Downloads directory.
The process is pretty self-explanatory. you just have to accept terms and conditions, and install Python.
Click on ADD Python to Path & Click on Install now and wait for a bit.
After Python is installed, hit close.
Now, If you want to check if Python is installed (for Windows Only)
Go to the command prompt in Windows.
py – – version
So, now that you've successfully installed Python on your computer.
Let's go ahead and set up a coding text editor.
Download and Install Visual Studio Code
In this section, we'll be downloading and setting up a Code Editor. In this case, we will install the Visual Studio Code.
It's a place where you can write and execute your code.
For this, we're going to use VS Code. We will be using the blue-colored logo.
Head over to https://www.code.visualstudio.com
Download the needed for your relevant operating system.
Click on the downloaded File, and this installer will open. Please read and accept the Terms and Conditions and click on ‘Next'.
Now don't forget to click on the ‘Create a Desktop Icon' option, for easy access.
Then click ‘Next'
Now click install, and Visual Studio Code will be installed on your computer.
Go ahead and search visual studio code in your Windows search bar.
Click on it and the interface shown below will pop up.
And Viola you've successfully set up Python and VS code, and are now ready to start coding.
But before we do.
We need to set up two basic settings in VS Code that will help you in the coding process.
Download and Install Python extension in Visual Studio code
On your Visual Studio Homepage, head over to the top left options, and select the small stack of boxes, that's the extension's icon.
Click on it. And Search for Python.
It is the top one with the most reviews. Click on install and Visual Studio will install it for you.
Installing the .run extension in Visual Studio code
In the same manner, install the following .run extension.
As same as you installed the Python extension in Visual Studio Code. You have to install this .run extension.
This will help you to run Code easily.
Go to the left Toolbar. And open extensions.
Search for run and install it.
Python Code Output in Terminal Setup in Visual Studio Code
Now for setting up the output of your python code results to the visual studio code terminal. Follow these instructions.
To have the code runner output to the terminal instead of the built-in output console, click the settings icon (gear icon) on the bottom left corner.
Scroll down until you see Code Actions on Save. Click settings.json and the file will open.
Add this line inside the json file: “code-runner.runInTerminal”: true,
Create a New Python File to Print “Hello World”
Now to see for a final time that everything is working properly.
Go to your Visual Studio Homepage.
Click on ‘New File'
Then go ahead and save it in your desired location whether on the Desktop or anywhere you desire.
Check the below image to see how your file will be.
Let's Print Hello World in the output.
Just Go to the Top left ‘Menu Bar' and click on File, then select the Programming language as Python. Press Ctrl+S or Cmd+S to save the file.
Now select where you want to save the file(choose the directory), give it a suitable name, and it will be saved.
I wrote a simple print command where we are printing “hello world” on the screen using the print statement in Python.
After writing the print statement, as you see a play button on the top right corner select the drop down right next to it and select Run Python file.
You can see the output has successfully been displayed in the terminal.
Now that all prerequisites are out of the way.
You can now do all the coding you want.
Conclusion on How to Download and Install Python with Visual Studio Code
So, I Hope that you have successfully installed Python and Visual Studio on your Computer, and know How to Download and Install Python with Visual Studio Code.
Good Luck with your Python Learning. Do check out Our Dope Python Projects on our site to further enhance your skills. They are beginner-friendly.
And Don't forget to comment your Queries down below in the comments.
We'll be happy to help.
Take care and Happy Coding.