Install VS Code

This should help you install VS Code with Python. This works at our school as of Fall 2026.

Part 1: Install Visual Studio Code

  1. Open Company Portal on your school laptop.
  2. Find and install Visual Studio Code (sometimes listed as VS Code).
    • Make sure you select Visual Studio Code, not plain Visual Studio. They are different programs.
  3. Wait for the installation to finish.

Part 2: Create a Folder for Your Python Programs

  1. Open File Explorer.
  2. Go to your Documents folder (not Downloads).
  3. Create a new folder with a useful name, such as CSP_Programs.
  4. Remember where you created this folder!

Why do I need a folder?

Your Python programs will sometimes need to load other files, such as images, data files, or additional Python code. Keeping everything in one folder makes it easier for Python to find those files and helps prevent “file not found” errors.

We will also install Python packages for this folder, so it’s important to keep your programs together.

Do not create your programming folder in Downloads.That folder gets too full, and this would slow you down.

Part 3: Open Your Folder in VS Code

  1. Open Visual Studio Code.
  2. If VS Code asks you to sign in with GitHub, skip that step. You do not need a GitHub account for this class.
  3. From the File menu, choose Open Folder.
  4. Find and select your CSP_Programs folder.
  5. If VS Code asks whether you trust the authors of the files in this folder, choose Yes, I trust the authors.

What is GitHub?

GitHub is a service programmers use to store code online, keep track of changes to their programs, and collaborate with other programmers. It’s a useful tool, but we won’t need it for CSP.

Part 4: Create Your First Python Program

  1. In VS Code, create a new file inside your CSP_Programs folder.
    (do this from File menu, or open the file explorer icon on the left vertical bar, then hover over the files to click the “+” icon)
  2. Name the file test_program.py.
    • Python program filenames must end in .py.
  3. Enter some print code such as this:
print("hi")
  1. Save your file using Ctrl+S.

You have a Python program now, but it probably will not run yet because Python still needs to be installed.

Part 5: Install Python

  1. VS Code should recognize that you are editing a Python file and offer to install the Python extension. Accept the installation.
  2. VS Code may also ask to install Python and uv. Accept this installation.
    • Python is the programming language interpreter that runs your programs.
    • uv is a tool that helps install and manage Python and additional Python packages.
  3. Look for the triangular Run (play) button near the upper-right corner of the editor.
  4. Click the Run button.
  5. If VS Code offers to download or install a Python interpreter using uv, accept the offer.

If everything works, you should see the output hi in the Terminal panel at the bottom of VS Code.

If Python doesn’t run:

  • Close VS Code completely and reopen it.
  • Open your CSP_Programs folder again and try running the program.
  • If necessary, restart your computer and try again.
  • If VS Code asks you to select a Python interpreter, choose the Python installation you just installed.

You can also check whether uv is available by opening View → Terminal and entering:

uv --version

If uv is working in your terminal, it should display a version number.

Checkpoint: Before continuing, make sure you can run test_program.py and see hi in the output.

Part 6: Set Up Your Python Project

Python has many additional libraries, called packages, that allow your programs to do more interesting things. For example, matplotlib lets Python create graphs and other data visualizations.

Before installing packages, we need to set up our folder as a Python project.

  1. In VS Code, open the View menu and choose Terminal.
  2. Make sure the terminal is working in your CSP_Programs folder.
  3. Type the following command and press Enter:
uv init

This initializes your folder as a Python project. It creates some additional files that help uv manage your project.

You only need to run uv init once for your CSP_Programs folder. You do not need to repeat it for every Python program.

Part 7: Install Your First Python Package

Now let’s install matplotlib, a package used for creating graphs.

  1. In the VS Code terminal, type:
uv add matplotlib
  1. Press Enter and wait for the installation to finish.
  2. uv should download matplotlib and any additional packages it requires.

The package is installed into a Python environment associated with your project. You can use this same environment for all the Python programs in your CSP_Programs folder.

Part 8: Test matplotlib

Return to test_program.py and replace its contents with:

import matplotlib.pyplot

print("Matplotlib imported successfully!")

Save and run your program.

If everything is working, you should see:

Matplotlib imported successfully!

If you get an error saying that matplotlib cannot be found, VS Code may be using the wrong Python interpreter. Ask your teacher for help selecting the interpreter associated with your project.

Part 9: Running Python Programs

Whenever you want to write or run Python programs:

  1. Open VS Code.
  2. Open your CSP_Programs folder.
  3. Open an existing .py file or create a new one.
  4. Write your Python code.
  5. Save your work with Ctrl+S.
  6. Click the triangular Run Python File button to run your program.

Your program’s output will appear in the Terminal panel.

Remember:

  • Keep your Python programs in CSP_Programs.
  • You only need to run uv init once for this folder.
  • You only need to install each package once for your project.
  • Always save your program before running it.
  • If Python cannot find a file or package, check that you have opened the correct folder and selected the correct Python interpreter.