HOW TO INSTALL PYTHON AND VSCODE: A STEP-BY-STEP GUIDE

TABLE OF CONTENTS

  • STEP 1: DOWNLOAD AND INSTALL PYTHON
  • STEP 2: ADD PYTHON TO YOUR PATH ENVIRONMENT VARIABLE
  • STEP 3: DOWNLOAD AND INSTALL VSCODE
  • STEP 4: INSTALL THE PYTHON EXTENSION FOR VSCODE
  • STEP 5: CREATE A NEW PYTHON FILE AND RUN IT

As I grew in this tech space, installing python on vscode became the easiest part of this tech journey.

There are 1 million and one tutorials on this topic but I just wanted to make mine because, even with the thousands of tutorials on this topic. it was still confusing as heck trying to install python on vscode .

why use python?

Python is a great choice if you’re searching for an easy and enjoyable approach to learn programming. Python is a general-purpose, high-level language that may be used for a number of tasks, including web development, data analysis, machine learning, automation, and more. Python has a simple syntax that emphasizes readability and simplicity and is also simple to understand and write.

You’ll need a Python interpreter and a code editor to get started coding in Python. A Python interpreter is a program that executes the commands in your Python code. You can write, edit, and debug your code using a code editor. There are numerous choices for both, but in this piece, I will show you how to install and use two of the most popular and widely used ones: Python and VSCode.

what is python?

Python is the official interpreter for the Python language. It is open-source, free, and cross-platform.

Python is a popular programming language that has many applications and benefits. It is easy to learn, write and read, as it uses a simple and clear syntax. It is also versatile, as it supports multiple paradigms such as object-oriented, functional and procedural programming. Python has a large and active community of developers and users, who contribute to its rich set of libraries and modules. Python can be used for web development, data analysis, machine learning, automation, scripting and more.

what is vscode?

VSCode is a popular code editor that supports many programming languages and features. It is free, open-source, and cross-platform. VSCode allows you to customize your workspace, debug your code, install extensions, and collaborate with others. VSCode is a great tool for developers of all levels and backgrounds.I’ll walk you through the process of setting up Python and VSCode on your computer and how to make them work together. I’ll also show you how to create and run your first Python program using these tools. Let’s get started!

STEP 1: DOWNLOAD AND INSTALL PYTHON

screenshot of python website

The first step is to download and install Python on your computer. You can get the latest version of Python from the official website: https://www.python.org/downloads/. Choose the installer that matches your operating system and follow the instructions. Make sure to check the option to add Python to your PATH environment variable, which will make it easier to run Python from any folder.

how to install python on:

  • WINDOWS: THERE are two main ways to install Python on Windows: using the official installer from Python.org or using the Microsoft Store. To use the official installer, you need to download the latest version of Python from https://www.python.org/downloads/windows/ Then, double-click the installer file to launch the setup wizard. In the setup window, you need to check the Add Python 3.8 to PATH option and click Install Now to begin the installation. It will take a few minutes to complete the setup. To use the Microsoft Store, you need to open the Store app and search for Python. You will see different versions of Python available for download. Choose the one that suits your needs and click Get to install it.
  • MAC: THE recommended way to install Python on macOS is to use an official installer. Here are the STEPS: First, download a Python release for macOS from https://www.python.org/downloads/mac-osx/.
    Second, run the installer by double-clicking the installer file.
    Third, follow the instruction on the screen and click Next until the installer completes.
  • LINUX: MOST Linux distributions come with Python pre-installed, so you may not need to install it manually. To check if you have Python on your Linux system, open a terminal and TYPE: PYTHON --versionTo check if Python is installed on a Linux system, you can also use the command whereis python in the terminal. If Python is installed, you will see a list of directories where Python is INSTALLED.If you want to check if Python is installed on a Linux system and which version is installed, you can use the command python -V or python --version in the terminal. This will display the version of Python installed on your system.If you see a response with the version of Python, then you are good to go. Otherwise, you can install Python using a package management system. For example, on Ubuntu, you can install Python 3.10 by running:bash
    python3 --
    VERSION. IF you are using Visual Studio Code as your code editor for Python, you might want to install the Python extension. This extension adds many features and tools that can help you write, debug, and test your Python code. You can find the Python extension in the Visual Studio Code marketplace, or use this direct link: https://marketplace.visualstudio.com/items?itemName=ms-python.python. Installing the extension is easy and fast, and you can start using it right away.

Python: The latest version of Python (3.10.0) has a file size of approximately 28.2 MB and takes around 1-2 minutes to install 

STEP 2: ADD PYTHON TO YOUR PATH ENVIRONMENT VARIABLE

What is a path?

The PATH environment variable is a list of directories that tells your operating system where to look for executable files, such as Python. It is important to add Python to the PATH because it allows you to run Python scripts and commands from any directory, without having to specify the full path to the Python interpreter. This makes it easier and faster to use Python on your system.

screenshot of enviroment variables on windows

Search edit environment variables on your system

 screenshot of system variable's

Under system variable look for path

screenshot of path

The next step is to add Python to your PATH environment variable, which will make it easier to run Python from any folder. This step may vary depending on your operating system, but here are some general guidelines:

  • On Windows, you can check the option to add Python to your PATH during the installation process, or you can manually edit the PATH variable from the Control Panel > System > Advanced System Settings > Environment Variables.
  • On Mac, you can edit the PATH variable from the Terminal by typing the command `echo ‘export PATH=”/Library/Frameworks/Python.framework/Versions/3.x/bin:${PATH}”‘ >> ~/.bash_profile` where 3.x is the version of Python that you installed. Then restart the Terminal for the changes to take effect.
  • On Linux, you can edit the PATH variable from the Terminal by typing the command `echo ‘export PATH=”/usr/local/bin/python3.x:${PATH}”‘ >> ~/.bashrc` where 3.x is the version of Python that you installed. Then restart the Terminal for the changes to take effect.

STEP 3: DOWNLOAD AND INSTALL VSCODE

screenshot of  vscode download site

The next step is to download and install VSCode on your computer. You can get the latest version of VSCode from the official website: https://code.visualstudio.com/download. Choose the installer that matches your operating system and follow the instructions. VSCode will automatically detect and use the Python interpreter that you installed in the previous step.

VSCode: The latest version of VSCode (1.61.0) has a file size of approximately 100 MB and takes around 5-10 minutes to install 

STEP 4: INSTALL THE PYTHON EXTENSION FOR VSCODE

screenshot of python in vscode

The Python extension for VSCode is a useful tool that provides features such as syntax highlighting, code completion, debugging, testing, formatting, and more. To install the Python extension, open VSCode and click on the Extensions icon on the left sidebar. Search for “Python” and click on the first result. Then click on the Install button.

STEP 5: CREATE A NEW PYTHON FILE AND RUN IT

screenshot of a new python file

To create a new Python file, open VSCode and click on the File menu. Then click on New File. Save the file with a .py extension, such as new.py. To run the file, right-click on it in the Explorer panel and select Run Python File in Terminal. You should see the output of your code in the integrated terminal at the bottom of VSCode.

Congratulations! You have successfully installed Python and VSCode and ran your first Python program. You can now use these tools to create and run more complex and interesting Python projects.

← Back

Thank you for your response. ✨

Warning
Warning
Warning
Warning

Warning.

Leave a comment

Hey!

Hello, I’m Maryclare. Dive into the world of technology with my Udemy courses, “Master C++ with Arduino/CNN” and “100 Projects with Web Scraping”. Join over 3000+ students in mastering tech skills that matter. Let’s explore, learn, and create together.

Join the club

Stay updated with our latest tips and other news by joining our newsletter.

Design a site like this with WordPress.com
Get started