🎓 A1Learner
🔍

Python Installation

Installing Python means putting Python 3 and its tools on a computer. The official site python.org provides the download.

Check the version

Type this command in a terminal. Your exact number may differ.

$ python3 --version
Python 3.12.4

Your first file

Save this code in a file named hello.py. The .py ending marks a Python file.

print("Hello, Python!")

Run the file

Type this command in the same folder as the file.

$ python3 hello.py
Hello, Python!

Example

print("Hello from hello.py!")
print("Python is ready.")

Key points

  • Python 3: the current main version of Python
  • Installing Python puts Python 3 on a computer, ready to run code.
  • Use the official site python.org to download Python
  • Terminal: a window where you type text commands for the computer
  • PATH: the list of folders the computer searches for programs
  • On Windows and Mac, run the installer file you downloaded
  • On Linux, Python 3 is often already installed
  • A version check confirms the install worked.

In this example, the code is saved as a file named hello.py. The first line prints a hello message. The second line prints that Python is ready. You run the file with the command python3 hello.py.

Note

On Windows, tick "Add Python to PATH" in the installer.

Without it, the python command may not work.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Python Playground

Exercise

Which command checks your Python version?