Install Python

Python Tutorial › Getting Started › Install Python

Install Python

BeginnerLesson 3 of 478 min read1 runnable examples

To write your own Python programs you need the Python interpreter on your computer. This lesson installs it on Windows, macOS or Linux, checks that it works, and runs your first script.

In this lesson
  • Install Python 3 on your OS
  • Check the installed version
  • Use the interactive shell
  • Run a .py file from the terminal

Check whether Python is already installed

Open a terminal (Command Prompt or PowerShell on Windows, Terminal on macOS and Linux) and run:

Terminal
$ python --versionPython 3.15.1

If you see a version number that starts with 3, Python is ready and you can skip to the interactive shell.

Note

On macOS and Linux the command may be python3 instead of python. On Windows, the py launcher (py --version) is installed alongside Python and picks the newest version for you.

Install Python on Windows

  1. Go to python.org, open Downloads and download the latest Python 3 installer for Windows.
  2. Run the installer. On the first screen tick Add python.exe to PATH. This lets you type python in any terminal.
  3. Click Install Now and wait for it to finish.
  4. Close and reopen your terminal, then run python --version again.
Watch out

If python opens the Microsoft Store instead of printing a version, PATH was not set. Re-run the installer, choose Modify, and tick Add Python to environment variables, or turn off the “App execution aliases” for python.exe in Windows Settings.

Install Python on macOS

  1. Download the macOS installer from python.org and run the .pkg file, or install with Homebrew: brew install python.
  2. Open Terminal and run python3 --version.

Install Python on Linux

Most Linux distributions already include Python 3. If yours does not, install it with the package manager:

  • Ubuntu or Debian: sudo apt install python3 python3-pip python3-venv
  • Fedora: sudo dnf install python3

The interactive shell (REPL)

Type python on its own to start the interactive shell. It shows a >>> prompt, runs each line as soon as you press Enter and prints the result:

Python shell
>>> 2 + 35>>> "py" * 3'pypypy'>>> exit()

The shell is perfect for trying one line. For anything longer, write a file.

Run your first Python file

Create a file called hello.py in any folder with this content:

hello.py
print("Hello from a Python file!")print("2 to the power 10 is", 2 ** 10)
Output
Hello from a Python file!
2 to the power 10 is 1024

Then run it from a terminal opened in that folder:

Terminal
$ python hello.pyHello from a Python file!2 to the power 10 is 1024
Tip

Python files always end in .py. Keep each practice program in its own file with a descriptive name such as list_sum.py, so you can find and re-run it later.

Install packages with pip

pip installs extra packages from PyPI, the Python Package Index. It comes with Python. Check that it works:

Terminal
$ python -m pip --versionpip 26.2.2 from C:\Python3\Lib\site-packages\pip (python 3.15)

You install a package with python -m pip install <name>, for example python -m pip install requests. The Modules & pip lesson covers this in detail, including virtual environments.

Check your understanding

Quick quiz

1. Which installer option lets you type python in any Windows terminal?

2. What does the >>> prompt mean?

3. Which command installs a package?

Program Practice

With Python installed, write each basic program in its own .py file and run it from the terminal.

Install Python FAQ

Which Python version should I install?

Install the newest Python 3 release from python.org. Libraries add support for new versions quickly, and every example in this tutorial works on current Python 3.

What is the difference between python and python3?

They are names for the interpreter. On Windows the command is usually python (or py). On macOS and many Linux systems python3 is the Python 3 interpreter and python may not exist.

Do I need an IDE to write Python?

No. Any text editor and a terminal are enough. An IDE such as PyCharm or VS Code adds autocomplete, debugging and a run button. See PyCharm & VS Code Setup.

How do I uninstall Python on Windows?

Open Settings > Apps > Installed apps, find Python 3.x and click Uninstall. Remove the Python Launcher the same way if you want it gone too.