4) Set Up Your Machine Lesson

How to Check if Python is Installed

5 min to complete · By Martin Breuss

To confirm that you've successfully installed Python and that everything is set up the way you need it, you can open up the terminal in VS Code:

  • Select View / Terminal in the VS Code menu
  • Press the keyboard shortcut Cmd + j (macOS) or Ctrl + j (Windows, Linux)

Either of these should open up a terminal at the bottom of your VS Code editor window. This terminal is the same terminal that you've worked with before, but it's integrated into the VS Code interface.

Now use the integrated terminal to confirm that your Python installation was successful by typing the following command:

python3 --version

You should see a response similar to this one:

Python 3.11.0

If you get this output on the terminal, then Python 3 has been successfully installed on your machine.

There's some wiggle room with the last two numbers of this output. Python keeps evolving and you might have a newer version than when these instructions were written. Higher numbers are fine, but it shouldn't be anything below 3.6.0.

The Python Interpreter

In your integrated terminal, type python3 and press Enter. The prompt on your terminal will change and you will see some text pop up. That means you have entered the Interactive Mode of your Python interpreter.

Essentially, this means that Python is now listening to you and waiting for your input. It's similar to saying Alexa, Ok Google or Hey Siri. Those three really listen to your input via audio, while the Python interpreter waits for your text input. Python tells you that it's waiting for you to type something by displaying three angular brackets (>>>).

It's time to feed some Python code to the hungry interpreter. Type import this and press Enter again. What do you see?

Investigate

Do a quick google search to figure out what this text is all about.

Once you are ready to end the interpreter session, type exit() and press Enter to quit your Python interpreter.

Read Evaluate Print Loop

What you just saw is your Python interpreter. It allows you to run and evaluate Python code line-by-line. These types of coding environments are often called REPLs, which stands for read-evaluate-print-loop.

Python reads and evaluates your input, then prints a response to the terminal. Then it loops back to the beginning and asks for your input again.

You can code all sorts of things using a REPL, however, once you close your interpreter session, the code you wrote is gone. Because your REPL is also very eager, it immediately evaluates each finished line of code, which makes it hard to build a longer script.

While your Python interpreter is helpful to quickly test something, you will spend most of your time working in a text editor or in an IDE to build Python scripts. IDE stands for Integrated Development Environment and you can think of it as a more powerful text editor. You'll learn about VS Code, the IDE you'll use in this course, in the next lesson.

Summary: How to Check if Python is Installed

Use the integrated terminal to confirm that your Python installation was successful by typing the following command:

python3 --version

You should see a response similar to this one:

Python 3.11.0

If you get this output on the terminal, then Python 3 has been successfully installed on your machine.