No history yet

Python Installation

Getting Python on Your Machine

Before you can start writing Python code, you need to install the Python interpreter on your computer. Think of the interpreter as the engine that understands and runs your Python instructions. The best place to get it is from the official source: python.org.

Head to the downloads page, and it should automatically suggest the right version for your operating system, whether it's Windows, macOS, or Linux. Download the latest stable version—avoid any pre-release or beta versions for now.

For Windows users: During installation, you'll see a checkbox that says "Add Python to PATH." Make sure you check this box! It's a small step that makes a big difference. It tells your computer where to find the Python interpreter, so you can run your scripts from any folder without any hassle.

Lesson image

If you're on macOS or Linux, you might already have an older version of Python installed. It's still a good idea to install the latest version from python.org to have access to the newest features. The installation process is straightforward on these systems, just follow the prompts.

A Place to Write Your Code

Now that Python is installed, you need a place to write and edit your code. You could use a basic text editor like Notepad, but a specialized tool called an Integrated Development Environment, or IDE, makes the job much easier. An IDE is like a programmer's workbench, equipped with tools that help you write, test, and fix your code more efficiently.

For beginners, a great choice is Thonny. It's designed specifically for learning Python, so its interface is clean and simple. It comes with Python built-in, but since you've already installed the latest version, Thonny will use that one. More importantly, it has features that help you see what your code is doing step-by-step, which is incredibly useful when you're starting out.

Lesson image

You can download Thonny from its website, thonny.org. Just like with Python, grab the version for your operating system and run the installer. Once it's finished, you'll have a complete setup for writing and running Python code.

Running Your First Script

Let's write a simple program to make sure everything is working. Open Thonny. You'll see two main areas. The top part is the editor, where you write your code. The bottom part is the shell, where you see the output of your code.

In the editor (the top window), type the following line of code:

print("Hello, Python!")

This code uses the print() function to display a message on the screen. Now, you need to save the file. Go to File > Save and name your file hello.py. The .py extension is important—it tells the computer that this is a Python script.

With the file saved, click the green "Run" button in the toolbar. Look at the shell at the bottom of the window. You should see your message:

Hello, Python!

Congratulations! You've just installed Python, set up your development environment, and run your very first script.

Time to check your understanding of these first steps.

Quiz Questions 1/4

What is the official and recommended source for downloading the Python interpreter?

Quiz Questions 2/4

What is the primary purpose of an Integrated Development Environment (IDE) like Thonny?

You're now all set to start exploring the world of Python programming.