codegurukool.com · Free coding tutorials & online compiler

Home › Python Tutorial › Python installation

Python installation

Full step-by-step installation for Windows, macOS and Linux.

Windows

  1. Open python.org/downloads and click Download Python 3.
  2. Run the installer. At the bottom of the first window, tick Add python.exe to PATH.
  3. Click Install Now and wait until it says Setup was successful.
  4. Close the window.

macOS

  1. Download the macOS installer from python.org/downloads.
  2. Open the .pkg file and follow the steps. Or run brew install python if you use Homebrew.

Linux (Ubuntu or Debian)

  1. Python is usually installed. Check with python3 --version.
  2. If not, run sudo apt update and then sudo apt install python3 python3-pip.

Check the installation

  1. Open a new terminal.
  2. Run python --version (use python3 --version on macOS and Linux).

Run your first program

  1. Save the code from the editor below as hello.py.
  2. In the terminal, go to its folder.
  3. Run python hello.py (or python3 hello.py).
  4. For an interactive prompt, type python and use exit() to leave.

If something goes wrong

Example code

print("Python is installed")

Run this code in the online editor

← Python introduction and get startedPython syntax and comments →