Installing Python takes about five minutes. Most of the trouble people hit comes from one checkbox on Windows, so this guide points at it clearly.
Before you install: do you need to?#
If you only want to try the language for an hour, use a browser-based Python editor. You need a local install once you want to work with your own files, install packages, or use an editor like VS Code.
Windows#
- Go to the official Python website and download the latest Python 3 installer for Windows.
- Run it. Tick “Add python.exe to PATH” on the first screen. This single checkbox causes most beginner problems when it is missed.
- Choose “Install Now”.
- Open a new terminal window (PowerShell or Command Prompt) and check it.
python --versionYou should see something like Python 3.12.4.
macOS#
macOS ships with an old Python that you should leave alone. Install your own:
- Simple: download the macOS installer from the official Python site and run it.
- With Homebrew:
brew install python
Then check:
python3 --versionOn macOS you usually type python3 and pip3 rather than python and pip.
Linux#
Most distributions include Python 3 already. If not:
sudo apt update
sudo apt install python3 python3-pip
python3 --versionConfirming everything works#
Three quick checks:
python --version
pip --version
python -c "print(2 + 2)"The last one should print 4. If all three work, you are done.
Why python and python3 both exist#
When Python 2 and 3 were both common, systems used python for the old one and python3 for the new. Python 2 is retired now, but the naming stuck on macOS and Linux. On Windows, python and py both point at Python 3.
If one command errors, try the other before assuming the install failed.
Installing a package#
pip install requestsIf pip is not found, use python -m pip install requests, which works whenever Python itself does.
Questions people ask#
Which version should I install?
The latest stable Python 3 release is right for learning. Only pin an older version if a specific tool you need requires it.
Do I need Anaconda?
Only if you are heading into data science, where it bundles the scientific packages for you. For general learning it is a large download you do not need.
My editor cannot find Python even though the terminal can
Editors keep their own interpreter setting. In VS Code, press Ctrl+Shift+P, run “Python: Select Interpreter”, and pick the version you just installed. See VS Code setup for beginners.
Can I have two versions installed?
Yes. On Windows, py -3.11 runs a specific version. Beyond that, virtual environments keep each project’s packages separate.
Where to go next#
- Your first Python program
- Set up VS Code for Python
- VS Code problems beginners hit — fixing “Python was not found”
- Python virtual environments explained — the next setup step