Title: Extra - Install and Setup Visual Studio Code (VS Code)

Info

If you already have VS Code set up for Python development and are familiar with the IDE, feel free to skip this section. The materials in the Bootcamp are tested on Python 3.12. It's recommended to have Python 3.9 or newer. Anaconda Python can be used if you're familiar with it.

Video Guide is Available
  • If you prefer a video that rather than text to guide you through the entire process of installing and setting up Visual Studio Code, please refer to the 🎥 Video #2 in the later part of this page.



Quick Guide for Setting Up VS Code for Python


Step 1: Install Visual Studio Code

  1. Visit the official Visual Studio Code website here ➡️ Visual Studio Code.

  2. Click on the download button and select the appropriate version for your operating system

  3. Once the installer is downloaded, run it. This will only take a minute.

  4. Install:

    • Windows: Run the downloaded .exe file and follow the installation prompts. Make sure to select "Add to PATH" during installation.
    • macOS: Open the downloaded .zip file, and drag the Visual Studio Code app to the Applications folder.
    • Linux: Depending on your distribution, you might download a .deb or .rpm file (for Debian/Ubuntu or Fedora/SUSE respectively). Install it using your package manager (e.g., dpkg -i for .deb or rpm -i for .rpm files).

Step 2: Install Python

  1. Download Python: Go to the official Python website and download the latest version for your operating system.
  2. Install Python:
    • Windows/Linux: Run the downloaded installer. Ensure you check the box that says "Add Python X.X to PATH" before clicking "Install Now."
    • macOS:
      • Open the .pkg file and follow the installation instructions.
      • Alternatively, install Python via brew. Refer to this guide.

Step 3: Install Python Extension in Visual Studio Code

  1. Open Visual Studio Code.
  2. Access Extensions: Click on the square icon on the sidebar or press Ctrl+Shift+X to open the Extensions view.
  3. Search and Install: Type "Python" in the search bar, find the Python extension by Microsoft (usually the first result), and click "Install."

Step 5: Test your Setup

  • Click on the first icon on the left panel  📄
    • Select a folder. Then, "right-click" > "new file".
  • Create a new file with a call "hello.py".
    • Write some Python code. For example: print("Hello World").
  • Select Python Interpreter:
    • Click on the "Select Python Interpreter" in the status bar at the bottom (see number 3 in the screenshot below),
    • or open the command palette (Ctrl+Shift+P or Cmd+Shift+P on macOS) and type "Python: Select Interpreter." 
    • Choose the Python interpreter you installed in Step 2 from the dropdown menu (see number 4 in the screenshot below).
  • To run the code, right-click anywhere in the file and select “Run Python File in Terminal”.




Good Intros to Visual Studio (VS) Code for Python (from Official Visual Studio's Channel)

Profile Recommended Videos to Watch
- I'm entirely new to Visual Studio Code.
- I have not been using any Integrated Development Environment (IDE).
All videos
- I have been using Visual Studio Code for other programming language(s) other than Python Video #2 and onwards
- I have been using Visual Studio Code for Python scripts, but have yet to try out writing and running Jupyter Notebook on Visual Studio Code Video #4


Video #1: Getting Started with VS Code



Video #2: Setting up VS Code for Python



Video #3: Python Extension in VS Code



Video #4: Jupyter Notebooks in VS Code