Home › Python Tutorial › Python installation
Python installation
Full step-by-step installation for Windows, macOS and Linux.
Windows
- Open
python.org/downloadsand click Download Python 3. - Run the installer. At the bottom of the first window, tick Add python.exe to PATH.
- Click Install Now and wait until it says Setup was successful.
- Close the window.
macOS
- Download the macOS installer from
python.org/downloads. - Open the .pkg file and follow the steps. Or run
brew install pythonif you use Homebrew.
Linux (Ubuntu or Debian)
- Python is usually installed. Check with
python3 --version. - If not, run
sudo apt updateand thensudo apt install python3 python3-pip.
Check the installation
- Open a new terminal.
- Run
python --version(usepython3 --versionon macOS and Linux).
Run your first program
- Save the code from the editor below as
hello.py. - In the terminal, go to its folder.
- Run
python hello.py(orpython3 hello.py). - For an interactive prompt, type
pythonand useexit()to leave.
If something goes wrong
'python' is not recognized: reinstall and tick Add python.exe to PATH, or trypy --version.- The Microsoft Store opens: turn off the Python app execution aliases in Windows settings.
Example code
print("Python is installed")